网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
单选题
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 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 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 { public String toString () { return “4”; } } class B extends A { 8. public String toString () { return super.toString() + “3”; } } public class Test { public static void main(Stringargs) { System.out.printIn(new B()); } } What is the result?() A、 Compilation succeeds and 4 is printed.B、 Compilation succeeds and 43 is printed.C、 An error on line 9 causes compilation to fail.D、 An error on line 14 causes compilation to fail.E、 Compilation succeeds but an exception is thrown at line 9.
考题
1. class BaseClass { 2. private float x = 1.of; 3. protected float getVar() { return x; } 4. } 5. class SubClass extends BaseClass { 6. private float x = 2.Of; 7. // insert code here 8. } Which two are valid examples of method overriding when inserted at line 7?() A、 float getVar() { return x; }B、 public float getVar() { return x; }C、 public double getVar() { return x; }D、 protected float getVar() { return x; }E、 public float getVar(float f) { return f; }
考题
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?() A、 public void getNum(){}B、 public void getNum(double d){}C、 public float getNum() { return 4.0f; }D、 public double getNum(float d) { return 4.0d; }
考题
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).
考题
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; }
考题
Given: 1. public class Method Over { 2. public void set Var (int a, int b, float c) { 3. } 4. } Which two overload the set Var method()?A、 private void set Var(int a, float c, int b) {}B、 protected void set Var(int a, int b, float c) {}C、 public int set Var(int a, float c, int b) {return a:}D、 public int set Var(int a, int b, float c) {return a:}E、 protected float set Var(int a, int b, float c) {return c:}
考题
public class X { public X aMethod() { return this;} } public class Y extends X { } Which two methods can be added to the definition of class Y?()A、 public void aMethod() {}B、 private void aMethod() {}C、 public void aMethod(String s) {}D、 private Y aMethod() { return null; }E、 public X aMethod() { return new Y(); }
考题
class BaseClass{ private float x= 1.0f; protected void setVar (float f) {x = f;} } class SubClass extends BaseClass { private float x = 2.0f; //insert code here } Which two are valid examples of method overriding?() A、 Void setVar(float f) {x = f;}B、 Public void setVar(int f) {x = f;}C、 Public void setVar(float f) {x = f;}D、 Public double setVar(float f) {x = f;}E、 Public final void setVar(float f) {x = f;}F、 Protected float setVar() {x=3.0f; return 3.0f; }
考题
class One { public One foo() { return this; } } class Two extends One { public One foo() { return this; } } class Three extends Two { // insert method here } Which two methods, inserted individually, correctly complete the Three class?()A、 public void foo() { }B、 public int foo() { return 3; }C、 public Two foo() { return this; }D、 public One foo() { return this; }E、 public Object foo() { return this; }
考题
class BaseClass{ private float x= 1.0f; protected void setVar (float f) {x = f;} } class SubClass exyends BaseClass { private float x = 2.0f; //insert code here 8. } Which two are valid examples of method overriding?()A、 Void setVar(float f) {x = f;}B、 Public void setVar(int f) {x = f;}C、 Public void setVar(float f) {x = f;}D、 Public double setVar(float f) {x = f;}E、 Public final void setVar(float f) {x = f;}F、 Protected float setVar() {x=3.0f; return 3.0f; }
考题
class super { public int getLength() {return 4;} } public class Sub extends Super { public long getLength() {return 5;} public static void main (Stringargs) { 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.
考题
Given the following code: 1) class Parent { 2) private String name; 3) public Parent(){} 4) } 5) public class Child extends Parent { 6) private String department; 7) public Child() {} 8) public String getValue(){ return name; } 9) public static void main(String arg[]) { 10) Parent p = new Parent(); 11) } 12) } Which line will cause error?() A、 line 3B、 line 6C、 line 7D、 line 8E、 line 10
考题
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; }
考题
public class MethodOver { public void setVar (int a, int b, float c) { } } Which two overload the setVar method?() A、 Private void setVar (int a, float c, int b) { }B、 Protected void setVar (int a, int b, float c) { }C、 Public int setVar (int a, float c, int b) (return a;)D、 Public int setVar (int a, int b, float c) (return a;)E、 Protected float setVar (int a, int b, float c) (return c;)
考题
1. class A { 3. public String to String() { 4. return “4”; 5. } 6. } 7. class B extends A { 8. public String toString() { 9. return super.toString() + “3”; 10. } 11. } 12. public class Test { 13. public static void main (String[] args) { 14. System.out.printIn(new B()); 15. } 16. } What is the result( )? A、 Compilation succeeds and 4 is printed.B、 Compilation …………… is printed.C、 An error on line 9 cause compilation to fail.D、 An error on line 14 cause compilation to fail.E、 Compilation succeeds but an exception is thrown at line 9.
考题
多选题public class MethodOver { public void setVar (int a, int b, float c) { } } Which two overload the setVar method?()APrivate void setVar (int a, float c, int b) { }BProtected void setVar (int a, int b, float c) { }CPublic int setVar (int a, float c, int b) (return a;)DPublic int setVar (int a, int b, float c) (return a;)EProtected float setVar (int a, int b, float c) (return c;)
考题
单选题Given the following code: 1) class Parent { 2) private String name; 3) public Parent(){} 4) } 5) public class Child extends Parent { 6) private String department; 7) public Child() {} 8) public String getValue(){ return name; } 9) public static void main(String arg[]) { 10) Parent p = new Parent(); 11) } 12) } Which line will cause error?()A
line 3B
line 6C
line 7D
line 8E
line 10
考题
单选题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.
考题
单选题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?()A
public void getNum(){}B
public void getNum(double d){}C
public float getNum() { return 4.0f; }D
public double getNum(float d) { return 4.0d; }
考题
多选题public class X { public X aMethod() { return this;} } public class Y extends X { } Which two methods can be added to the definition of class Y?()Apublic void aMethod() {}Bprivate void aMethod() {}Cpublic void aMethod(String s) {}Dprivate Y aMethod() { return null; }Epublic X aMethod() { return new Y(); }
考题
单选题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 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).
考题
单选题class super { public int getLength() {return 4;} } public class Sub extends Super { public long getLength() {return 5;} public static void main (Stringargs) { 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.
考题
单选题1. class A { 3. public String to String() { 4. return “4”; 5. } 6. } 7. class B extends A { 8. public String toString() { 9. return super.toString() + “3”; 10. } 11. } 12. public class Test { 13. public static void main (String[] args) { 14. System.out.printIn(new B()); 15. } 16. } What is the result( )?A
Compilation succeeds and 4 is printed.B
Compilation …………… is printed.C
An error on line 9 cause compilation to fail.D
An error on line 14 cause compilation to fail.E
Compilation succeeds but an exception is thrown at line 9.
考题
单选题class A { public String toString () { return “4”; } } class B extends A { 8. public String toString () { return super.toString() + “3”; } } public class Test { public static void main(Stringargs) { System.out.printIn(new B()); } } What is the result?()A
Compilation succeeds and 4 is printed.B
Compilation succeeds and 43 is printed.C
An error on line 9 causes compilation to fail.D
An error on line 14 causes compilation to fail.E
Compilation succeeds but an exception is thrown at line 9.
考题
单选题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; }
热门标签
最新试卷