1. class Super { 2. public float getNum() { return 3.0f; } 3. } 4. 5. public class Sub extends Super { 6. 7. } Which method, placed at line6, causes compilation to fail?()
第1题:
第2题:
Which statements concerning the following code are true?() class a { public a() {} public a(int i) { this(); } } class b extends a { public boolean b(String msg) { return false; } } class c extends b { private c() { super(); } public c(String msg) { this(); } public c(int i) {} }
第3题:
class super { public int getLength() {return 4;} } public class Sub extends Super { public long getLength() {return 5;} public static void main (String[]args) { super sooper = new Super (); Sub sub = new Sub(); System.out.printIn( sooper.getLength()+ “,” + sub.getLength() }; } What is the output?()
第4题:
class Super { public int i = 0; public Super(String text) { i = 1; } } public class Sub extends Super { public Sub(String text) { i = 2; } public static void main(String args[]) { Sub sub = new Sub(“Hello”); System.out.println(sub.i); } } What is the result?()
第5题:
1. class super { 2. public float getNum() {return 3.0f;} 3. } 4. 5. public class Sub extends Super { 6. 7. } Which method, placed at line 6, will cause a compiler error?()
第6题:
The description of the class and its purpose
A list of methods in its super class
A list of member variable
The class hierarchy
第7题:
0
1
2
Compilation fails.
第8题:
The code will fail to compile.
The constructor in a that takes an int as an argument will never be called as a result of constructing an object of class b or c.
Class c has three constructors.
Objects of class b cannot be constructed.
At most one of the constructors of each class is called as a result of constructing an object of class c.
第9题:
BigDog() { super(); this(); }
BigDog() { String name = Fido; super(); }
BigDog() { super(); String name = Fido; }
private BigDog() { super();}
第10题:
4, 4
4, 5
5, 4
5, 5
The code will not compile.
第11题:
Compilation will fail.
Compilation will succeed and the program will print “0”
Compilation will succeed and the program will print “1”
Compilation will succeed and the program will print “2”
第12题:
this.commission = commission;
superb(); commission = commission;
this.commission = commission; superb();
super(name, baseSalary); this.commission = commission;
super(); this.commission = commission;
this.commission = commission; super(name, baseSalary);
第13题:
class A { A() { } } class B extends A { } Which two statements are true?()
第14题:
class super { public float getNum() {return 3.0f;} } public class Sub extends Super { } Which method, placed at line 6, will cause a compiler error?()
第15题:
Which two login-class permissions could permit a user to view the system hierarchy of the active configuration?()
第16题:
public class Employee{ private String name; public Employee(String name){ this.name = name; } public void display(){ System.out.print(name); } } public class Manager extends Employee{ private String department; public Manager(String name,String department){ super(name); this.department = department; } public void display(){ System.out.println( super.display()+”,”+department); } } 执行语句new Manager(“smith”,”SALES”)后程序的输出是哪项?()
第17题:
In the Java API documentation which sections are included in a class document?()
第18题:
Compilation succeeds and 4 is printed.
Compilation succeeds and 43 is printed.
An error on line 9 causes compilation to fail.
An error on line 14 causes compilation to fail.
Compilation succeeds but an exception is thrown at line 9.
第19题:
4,4
4,5
5,4
5,5
Compilation fails.
第20题:
Class B’s constructor is public.
Class B’s constructor has no arguments.
Class B’s constructor includes a call to this().
Class B’s constructor includes a call to super().
第21题:
Public float getNum() {return 4.0f; }
Public void getNum () { }
Public void getNum (double d) { }
Public double getNum (float d) {retrun 4.0f; }
第22题:
Public float getNum() {return 4.0f; }
Public void getNum (){}
Public void getNum (double d){}
Public double getNum (float d) {retrun 4.0f; }
第23题:
Change line 2 to: public int a;
Change line 2 to: protected int a;
Change line 13 to: public Sub() { this(5); }
Change line 13 to: public Sub() { super(5); }
Change line 13 to: public Sub() { super(a); }
第24题:
insert a call to this() in the Car constructor
insert a call to this() in the MeGo constructor
insert a call to super() in the MeGo constructor
insert a call to super(vin) in the MeGo constructor
change the wheelCount variable in Car to protected
change line 3 in the MeGo class to super.wheelCount = 3;