A.PublicfloatgetNum(){return4.0f;}
B.PublicvoidgetNum(){}
C.PublicvoidgetNum(doubled){}
D.PublicdoublegetNum(floatd){retrun4.0f;}
第1题:
classSuper{publicIntegergetLenght(){returnnewInteger(4);}}publicclassSubextendsSuper{publicLongGetLenght(){returnnewLong(5);}publicstaticvoidmain(String[]args){Supersooper=newSuper();Subsub=newSub();System.out.println(sooper.getLenght().toString()+,”+sub.getLenght().toString());}}Whatistheoutput?()
A.4,4
B.4,5
C.5,4
D.5,5
E.Compilationfails.
第2题:
A.PublicfloatgetNum(){return4.0f;}
B.PublicvoidgetNum(){}
C.PublicvoidgetNum(doubled){}
D.PublicdoublegetNum(floatd){retrun4.0f;}
第3题:
将以下哪种方法插入到第6行是不合法的() 。 1.public class Test1 { 2. public float aMethod(float a,float b) throws 3. IOException { } 4. } 5.public class Test2 extends Test1{ 6. 7.}
A.float aMethod(float a,float b){ }
B.public int aMethod(int a,int b)throws Exception{ }
C.public float aMethod(float p,float q){ }
D.public int aMethod(int a,int b)throws IOException{ }
第4题:
A.publicvoidgetNum(){}
B.publicvoidgetNum(doubled){}
C.publicfloatgetNum(){return4.0f;}
D.publicdoublegetNum(floatd){return4.0d;}
第5题:
将下列哪个代码(A,B,C,D)放入程序中标注的【代码】处将导致编译错误? class A { public float getNum() { return 3.0f; } } public class B extends A { 【代码】 }
A.public float getNum(){return 4.0f;}
B.public void getNum(){ }
C.public void getNum(double d){ }
D.public double getNum(float d){return 4.0d;}