Public float getNum() {return 4.0f; }
Public void getNum () { }
Public void getNum (double d) { }
Public double getNum (float d) {retrun 4.0f; }
第1题:
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?()
第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题:
类Test1定义如下: 1.public class Test1{ 2. public float aMethod(float a,float b){ return 0;} 3. 4.} 将以下哪种方法插入行3是不合法的。()
第4题:
1. public class X ( 2. public object m () { 3. object o = new float (3.14F); 4. object [] oa = new object [1]; 5. oa[0]= o; 6. o = null; 7. return oa[0]; 8. } 9. } When is the float object created in line 3, eligible for garbage collection?()
第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题:
4,4
4,5
5,4
5,5
Compilation fails.
第7题:
public float aMethod(float a, float b,float c){ return 0;}
public float aMethod(float c,float d){ return 0;}
public int aMethod(int a, int b){ return 0;}
private float aMethod(int a,int b,int c){ return 0;}
第8题:
4, 4
4, 5
5, 4
5, 5
The code will not compile.
第9题:
Public float getNum() {return 4.0f; }
Public void getNum (){}
Public void getNum (double d){}
Public double getNum (float d) {retrun 4.0f; }
第10题:
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; }
第11题:
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); }
第12题:
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;)
第13题:
public class MethodOver { public void setVar (int a, int b, float c) { } } Which two overload the setVar method?()
第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题:
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?()
第16题:
1. public class OuterClass { 2. private double d1 = 1.0; 3. // insert code here 4. } Which two are valid if inserted at line 3?()
第17题:
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.
第18题:
private void set Var(int a, float c, int b) {}
protected void set Var(int a, int b, float c) {}
public int set Var(int a, float c, int b) {return a:}
public int set Var(int a, int b, float c) {return a:}
protected float set Var(int a, int b, float c) {return c:}
第19题:
Public float getNum() {return 4.0f; }
Public void getNum () { }
Public void getNum (double d) { }
Public double getNum (float d) {retrun 4.0f; }
第20题:
public void getNum(){}
public void getNum(double d){}
public float getNum() { return 4.0f; }
public double getNum(float d) { return 4.0d; }
第21题:
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; }
第22题:
static class InnerOne { public double methoda() { return d1; } }
static class InnerOne { static double methoda() { return d1; } }
private class InnerOne { public double methoda() { return d1; } }
protected class InnerOne { static double methoda() { return d1; } }
public abstract class InnerOne { public abstract double methoda(); }
第23题:
Compilation succeeds.
An exception is thrown.
Compilation fails because of an error at line 2.
Compilation fails because of an error at line 6.
第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;