Void setVar(float f) {x = f;}
Public void setVar(int f) {x = f;}
Public void setVar(float f) {x = f;}
Public double setVar(float f) {x = f;}
Public final void setVar(float f) {x = f;}
Protected float setVar() {x=3.0f; return 3.0f; }
第1题:
class super { public float getNum() {return 3.0f;} } public class Sub extends Super { } Which method, placed at line 6, will cause a compiler error?()
第2题:
1. abstract class AbstractIt { 2. abstract float getFloat(); 3. } 4. public class AbstractTest extends AbstractIt { 5. private float f1 = 1.0f; 6. private float getFloat() { return f1; } 7. } What is the result?()
第3题:
abstract class abstrctIt { abstract float getFloat (); } public class AbstractTest extends AbstractIt { private float f1= 1.0f; private float getFloat () {return f1;} } What is the result? ()
第4题:
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?()
第5题:
public class MethodOver { private int x, y; private float z; public void setVar(int a, int b, float c){ x = a; y = b; z = c; } } Which two overload the setVar method?()
第6题:
public class MethodOver { public void setVar (int a, int b, float c) { } } Which two overload the setVar method?()
第7题:
Given: 10. class One { 11. void foo() { } 12. } 13. class Two extends One { 14. //insert method here 15. } Which three methods, inserted individually at line 14, will correctly complete class Two?()
第8题:
Compilation is successful.
An error on line 6 causes a runtime failure.
An error at line 6 causes compilation to fail.
An error at line 2 causes compilation to fail.
第9题:
Compilation succeeds.
An exception is thrown.
Compilation fails because of an error at line 2.
Compilation fails because of an error at line 6.
第10题:
float[] = new float(3);
float f2[] = new float[];
float[] f1 = new float[3];
float f3[] = new float[3];
float f5[] = { 1.0f, 2.0f, 2.0f };
float f4[] = new float[] { 1.0f. 2.0f. 3.0f};
第11题:
Void setVar(float f) {x = f;}
Public void setVar(int f) {x = f;}
Public void setVar(float f) {x = f;}
Public double setVar(float f) {x = f;}
Public final void setVar(float f) {x = f;}
Protected float setVar() {x=3.0f; return 3.0f; }
第12题:
void setVar (int a, int b, float c){ x = a; y = b; z = c; }
public void setVar(int a, float c, int b) { setVar(a, b, c); }
public void setVar(int a, float c, int b) { this(a, b, c); }
public void setVar(int a, float b){ x = a; z = b; }
public void setVar(int ax, int by, float cz) { x = ax; y = by; z = cz; }
第13题:
class One { void foo() {} } class Two extends One { //insert method here } Which three methods, inserted individually at line 14, will correctly complete class Two?()
第14题:
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()?
第15题:
Which two cause a compiler error?()
第16题:
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?()
第17题:
Which two are valid declarations of a float?()
第18题:
Which three statements are true?()
第19题:
Private void setVar (int a, float c, int b) { }
Protected void setVar (int a, int b, float c) { }
Public int setVar (int a, float c, int b) (return a;)
Public int setVar (int a, int b, float c) (return a;)
Protected float setVar (int a, int b, float c) (return c;)
第20题:
Void setVar(float f) {x = f;}
Public void setVar(int f) {x = f;}
Public void setVar(float f) {x = f;}
Public double setVar(float f) {x = f;}
Public final void setVar(float f) {x = f;}
Protected float setVar() {x=3.0f; return 3.0f; }
第21题:
Public float getNum() {return 4.0f; }
Public void getNum (){}
Public void getNum (double d){}
Public double getNum (float d) {retrun 4.0f; }
第22题:
float getVar() { return x; }
public float getVar() { return x; }
public double getVar() { return x; }
protected float getVar() { return x; }
public float getVar(float f) { return f; }
第23题:
A final method in class X can be abstract if and only if X is abstract.
A protected method in class X can be overridden by any subclass of X.
A private static method can be called only within other static methods in class X.
A non-static public final method in class X can be overridden in any subclass of X.
A public static method in class X can be called by a subclass of X without explicitly referencing the class X.
A method with the same signature as a private final method in class X can be implemented in a subclass of X.
A protected method in class X can be overridden by a subclass of X only if the subclass is in the same package as X.
第24题:
Void setVar(float f) {x = f;}
Public void setVar(int f) {x = f;}
Public void setVar(float f) {x = f;}
Public double setVar(float f) {x = f;}
Public final void setVar(float f) {x = f;}
Protected float setVar() {x=3.0f; return 3.0f; }