问题:构造函数只能重载不能覆盖
查看答案
问题: 现有: class Banana2 f static int X=2; public static void main (String [] args) { int X=2; Banana2 b=new Banana2(); b.go(x); } static {x+=x; } void go (int x) { ++x; System. out.println (x); } 结果为:() A、7B、5C、3D、2
问题:Which statements concerning the value of a member variable are true, when no explicit assignments have been made?() A、The value of an int is undetermined.B、The value of all numeric types is zero.C、The compiler may issue an error if the variable is used before it is initialized.D、The value of a String variable is "" (empty string).E、The value of all object variables is null.
问题: 现有: 1. interface Altitude { 2. //insert code here 3. } 和4个声明: int HIGH = 7; public int HIGH = 7; abstract int HIGH = 7; interface int HIGH = 7; 分别插入到第2行,有多少行可以编译?() A、 0B、 1C、 2D、 3E、 4
问题:以下关于File对象的描述中,错误的是()A、File对象是不可变的,一旦创建,它所指向的文件就不能改变;B、File对象不一定要指向实际存在的文件或文件夹;C、File类具有强大的文件和文件夹操作能力;D、File对象的功能仅限于关于文本文件;
问题:You want a class to have access to members of another class in the same package. Which is the most restrictive access modifier that will accomplish that will accomplish this objective?()A、 PublicB、 PrivateC、 ProtectedD、 TransientE、 No access modifier is required.
问题:Java语言中表达式“11”+22的结果是哪项?() A、33B、1122C、22D、表达式错误
问题: 1. interface A { public void aMethod(); } 2. interface B { public void bMethod(); } 3. interface C extends A,B { public void cMethod(); } 4. class D implements B { 5. public void bMethod() { } 6. } 7. class E extends D implements C { 8. public void aMethod() { } 9. public void bMethod() { } 10. public void cMethod() { } 11. } What is the result?() A、 Compilation fails because of an error in line 3.B、 Compilation fails because of an error in line 7.C、 Compilation fails because of an error in line 9.D、 If you define D e = new E(), then e.bMethod() invokes the version of bMethod()defined in Line 5.E、 If you define D e = (D)(new E()),then e.bMethod() invokes the version of bMethod() defined in Line 5.F、 If you define D e = (D)(new E()), then e.bMethod() invokes the version of bMethod() defined in Line 9.
问题: Given: 3.public class MyTagHandler extends TagSupport { 4.public int doStartTag() { 5.// insert code here 6.// return an int 7.} 8.// more code here ... 18.} There is a single attribute foo in the session scope. Which three code fragments,inserted independently atline 5,return the value of the attribute?()A、Object o = pageContext.getAttribute("foo");B、Object o = pageContext.findAttribute("foo");C、Object o = pageContext.getAttribute("foo",PageContext.SESSION_SCOPE);D、HttpSession s = pageContext.getSession();Object o = s.getAttribute("foo");
问题:什么是多态?面向对象程序设计为什么要引人多态的特性?使用多态有什么优点?
问题: String s= "hello"; String t = "hello"; char c[] = {’h’,’e’,’l’,’l’,’o’} ; Which return true?() A、 s.equals(t);B、 t.equals(c);C、 s==t;D、 t.equals(new String("hello"));E、 t==c;
问题: You are assigned the task of building a panel containing a TextArea at the top, a label directly below it,and a button directly below the label. If the three components are added directly to the panel. Which layout manager can the panel use to ensure that the TextArea absorbs all of the free vertical space when the panel is resized?()A、 GridLayout.B、 CardLayout.C、 FlowLayout.D、 BorderLayout.E、 GridBagLayout.
问题:Which two can be used to create a new Thread? ()A、 Extend java.lang.Thread and override the run method.B、 Extend java.lang.Runnable and override the start method.C、 Implement java.lang.thread and implement the run method.D、 Implement java.lang.Runnable and implement the run method.E、 Implement java.lang.Thread and implement the start method.
问题: Given: 6.<% int[] nums = {42, 420, 4200}; 7.request.setAttribute("foo", nums); %> Which two successfully translate and result in a value of true?()A、${true or false}B、${requestScope[foo][0] > 500}C、${requestScope[’foo’][1] = 420}D、${(requestScope[’foo’][0] lt 50) && (3 gt 2)}
问题: public class Test { public static void main(String[] args) { int x = 0; assert (x > 0) ? “assertion failed” : “assertion passed”; System.out.println(“Finished”); } } What is the result?() A、 finishedB、 Compilation fails.C、 An AssertionError is thrown and finished is output.D、 An AssertionError is thrown with the message “assertion failed”.E、 An AssertionError is thrown with the message “assertion passed”.
问题:程序员已经创建了一个类,该类的实例可以用做Hashtable 的键(key)。哪两项是对的?() A、该类有一个返回类型为 int 的 equals 方法。B、该类有一个返回类型为 boolean 的 equals 方法。C、该类有一个接收一个参数的 equals 方法。D、该类有一个接收两个参数的 equals 方法。
问题:类的可访问性不影响类成员的可访问性
问题:下面说法正确的是()A、继承表示is-a的关系B、继承表示has-a的关系C、要表示has-a的关系必须使用接口D、可以使用实例变量表示has-a的关系
问题: 现有: import java.util.*; class ScanStuff { public static void main (String [] args) { String S= "x,yy,123"; Scanner sc = new Scanner (s); while (sc.hasNext()) System.out.print (sc.next() +" "); } } 结果是什么?() A、 x yyB、 x,yy,123C、 x yy 123D、 x,yyE、编译失败F、运行的时候有异常抛出
问题:swtich(expression)语句中表达式的类型可以是()A、StringB、charC、shortD、double