网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
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 (straing args) ( sub sub = new sub (“Hello”); system.out. PrintIn(sub.i); ) ) What is the result?()
- A、 Compilation will fail.
- B、 Compilation will succeed and the program will print “0”
- C、 Compilation will succeed and the program will print “1”
- D、 Compilation will succeed and the program will print “2”
参考答案
更多 “ 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 (straing args) ( sub sub = new sub (“Hello”); system.out. PrintIn(sub.i); ) ) What is the result?()A、 Compilation will fail.B、 Compilation will succeed and the program will print “0”C、 Compilation will succeed and the program will print “1”D、 Compilation will succeed and the program will print “2”” 相关考题
考题
Click the Exhibit button. What two must the programmer do to correct the compilation errors? ()
A.insert a call to this() in the Car constructorB.insert a call to this() in the MeGo constructorC.insert a call to super() in the MeGo constructorD.insert a call to super(vin) in the MeGo constructorE.change the wheelCount variable in Car to protectedF.change line 3 in the MeGo class to super.wheelCount = 3;
考题
已知:Manager extends Employee观察:public Manager(String n,double s,int year,int month,int day) { super(n,s,year,month,day); bonus=0; }其中super是 ( )A.Object类B.Manager类C.Employee类D.Class类
考题
The lower-level classes (known as subclasses or derived classes) ( ) state and behavior from the higher-level class (known as a super class or base class).A.request B.inherit C.invoke D.accept
考题
The lower-level classes(known as subclasses or derived classes) ( )state andbehavior from the higher-level class(known as a super class or base class).A.request
B.inherit
C.invoke
D.accept
考题
class A { A() { } } class B extends A { } Which two statements are true?()A、 Class B’s constructor is public.B、 Class B’s constructor has no arguments.C、 Class B’s constructor includes a call to this().D、 Class B’s constructor includes a call to super().
考题
class Super { public int getLenght( ) { return 4; } } public class Sub extends Super { public long getLenght( ) { return 5; } public static void main(String[] args) { Super sooper = new Super( ); Sub sub = new Sub( ); System.out.println( sooper.getLenght( ) + “,” + sub.getLenght( ) ); } } What is the output?()A、 Just after line 13.B、 Just after line 14.C、 Just after line 15.D、 Just after line 16 (that is, as the method returns).
考题
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) {} } A、The code will fail to compile.B、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.C、Class c has three constructors.D、Objects of class b cannot be constructed.E、At most one of the constructors of each class is called as a result of constructing an object of class c.
考题
class super { public float getNum() {return 3.0f;} } public class Sub extends Super { } Which method, placed at line 6, will cause a compiler error?()A、 Public float getNum() {return 4.0f; }B、 Public void getNum (){}C、 Public void getNum (double d){}D、 Public double getNum (float d) {retrun 4.0f; }
考题
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?() A、 4, 4B、 4, 5C、 5, 4D、 5, 5E、 The code will not compile.
考题
Which two login-class permissions could permit a user to view the system hierarchy of the active configuration?()A、system permissionB、view-configuration permissionC、network permissionD、super-user permission
考题
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?() A、 0B、 1C、 2D、 Compilation fails.
考题
1. class Super { 2. private int a; 3. protected Super(int a) { this.a = a; } 4. } ..... 11. class Sub extends Super { 12. public Sub(int a) { super(a); } 13. public Sub() { this.a= 5; } 14. } Which two, independently, will allow Sub to compile?()A、 Change line 2 to: public int a;B、 Change line 2 to: protected int a;C、 Change line 13 to: public Sub() { this(5); }D、 Change line 13 to: public Sub() { super(5); }E、 Change line 13 to: public Sub() { super(a); }
考题
Assume that country is set for each class. Given: 10. public class Money { 11. private String country, name; 12. public getCountry() { return country; } 13.} and: 24. class Yen extends Money { 25. public String getCountry() { return super.country; } 26. } 27. 28. class Euro extends Money { 29. public String getCountry(String timeZone) { 30. return super.getCountry(); 31. } 32. } Which two are correct?()A、 Yen returns correct values.B、 Euro returns correct values.C、 An exception is thrown at runtime.D、 Yen and Euro both return correct values.E、 Compilation fails because of an error at line 25.F、 Compilation fails because of an error at line 30.
考题
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”)后程序的输出是哪项?() A、 smith,SALESB、 null,SALESC、 smith,nullD、 null,null
考题
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?() A、 Public float getNum() {return 4.0f; }B、 Public void getNum () { }C、 Public void getNum (double d) { }D、 Public double getNum (float d) {retrun 4.0f; }
考题
In the Java API documentation which sections are included in a class document?() A、 The description of the class and its purposeB、 A list of methods in its super classC、 A list of member variableD、 The class hierarchy
考题
多选题In the Java API documentation which sections are included in a class document?()AThe description of the class and its purposeBA list of methods in its super classCA list of member variableDThe class hierarchy
考题
单选题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?()A
0B
1C
2D
Compilation fails.
考题
单选题class Super { public Integer getLenght() { return new Integer(4); } } public class Sub extends Super { public Long GetLenght() { return new Long(5); } public static void main(String[] args) { Super sooper = new Super(); Sub sub = new Sub(); System.out.println( sooper.getLenght().toString() + “,” + sub.getLenght().toString() ); } } What is the output?()A
4,4B
4,5C
5,4D
5,5E
Compilation fails.
考题
多选题class A { A() { } } class B extends A { } Which two statements are true?()AClass B’s constructor is public.BClass B’s constructor has no arguments.CClass B’s constructor includes a call to this().DClass B’s constructor includes a call to super().
考题
多选题1. class BigDog extends Dog { 2. // insert code here 3. } 分别插入到第 2 行,哪二项可以编译?()ABigDog() { super(); this(); }BBigDog() { String name = Fido; super(); }CBigDog() { super(); String name = Fido; }Dprivate BigDog() { super();}
考题
单选题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?()A
Public float getNum() {return 4.0f; }B
Public void getNum () { }C
Public void getNum (double d) { }D
Public double getNum (float d) {retrun 4.0f; }
考题
单选题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?()A
4, 4B
4, 5C
5, 4D
5, 5E
The code will not compile.
考题
单选题class super { public float getNum() {return 3.0f;} } public class Sub extends Super { } Which method, placed at line 6, will cause a compiler error?()A
Public float getNum() {return 4.0f; }B
Public void getNum (){}C
Public void getNum (double d){}D
Public double getNum (float d) {retrun 4.0f; }
考题
单选题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 (straing args) ( sub sub = new sub (“Hello”); system.out. PrintIn(sub.i); ) ) What is the result?()A
Compilation will fail.B
Compilation will succeed and the program will print “0”C
Compilation will succeed and the program will print “1”D
Compilation will succeed and the program will print “2”
考题
多选题1. class Super { 2. private int a; 3. protected Super(int a) { this.a = a; } 4. } ..... 11. class Sub extends Super { 12. public Sub(int a) { super(a); } 13. public Sub() { this.a= 5; } 14. } Which two, independently, will allow Sub to compile?()AChange line 2 to: public int a;BChange line 2 to: protected int a;CChange line 13 to: public Sub() { this(5); }DChange line 13 to: public Sub() { super(5); }EChange line 13 to: public Sub() { super(a); }
考题
多选题public class Car { private int wheelCount; private String vin; public Car(String vin) { this.vin = vin; this.wheelCount = 4; } public String drive() { return “zoom-zoom”; } public String getInfo() { return “VIN: “+ vin + “wheels: “+ wheelCount; } } And: public class MeGo extends Car { public MeGo(String vin) { this.wheelCount = 3; } } What two must the programmer do to correct the compilation errors?()Ainsert a call to this() in the Car constructorBinsert a call to this() in the MeGo constructorCinsert a call to super() in the MeGo constructorDinsert a call to super(vin) in the MeGo constructorEchange the wheelCount variable in Car to protectedFchange line 3 in the MeGo class to super.wheelCount = 3;
考题
单选题class Super { public int getLenght( ) { return 4; } } public class Sub extends Super { public long getLenght( ) { return 5; } public static void main(String[] args) { Super sooper = new Super( ); Sub sub = new Sub( ); System.out.println( sooper.getLenght( ) + “,” + sub.getLenght( ) ); } } What is the output?()A
Just after line 13.B
Just after line 14.C
Just after line 15.D
Just after line 16 (that is, as the method returns).
热门标签
最新试卷