单项选择题
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; }
点击查看答案
相关考题
- 单项选择题 public class test( public int aMethod()[ static int i=0; i++; return I; ) public static void main (String args){ test test = new test(); test.aMethod(); int j = test.aMethod(); System.out.printIn(j); ] } What is the result?()
- 单项选择题 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? ()
- 单项选择题 Youwantsubclassesinanypackagetohaveaccesstomembersofasuperclass.Whichisthemostrestrictiveaccessmodifierthatwillaccomplishthisobjective?()
- 单项选择题 Whichwilldeclareamethodthatforcesasubclasstoimplementit?()
- 单项选择题 public class foo { public static void main (Stringargs) { String s; system.out.printIn (“s=” + s); } } What is the result?()
- 单项选择题 下列代码的执行结果是()int index = 1; int foo[] = new int [3]; int bar = foo [index] int baz = bar + index;
- 单项选择题 public class test( public static void main(stringargs){ string foo = args [1]; string foo = args ; string foo = args ; } ) And command line invocation: Java Test red green blue What is the result? ()
- 单项选择题 int index = 1; boolean test = new Boolean; boolean foo= test [index]; What is the result?()
- 多项选择题 Whichthreearevaliddeclarationsofafloat?()
- 多项选择题 WhichtwostatementsarereservedwordsinJava?()
- 单项选择题 //point X public class foo ( public static void main (Stringargs) throws Exception { printWriter out = new PrintWriter (new ) java.io.outputStreamWriter (System.out), true; out.printIn(“Hello”); } ) Which statement at PointX on line 1 allows this code to compile and run?()
- 单项选择题 interface foo { int k = 0; } public class test implements Foo ( public static void main(String args) ( int i; Test test = new test (); i= test.k; i= Test.k; i= Foo.k; ) ) What is the result? ()
- 单项选择题 public class enclosingone ( public class insideone{} ) public class inertest( public static void main (stringargs)( enclosingone eo= new enclosingone (); //insert code here ) ) Which statement at line 7 constructs an instance of the inner class?()
- 单项选择题 package foo; public class Outer ( public static class Inner ( ) ) Which statement is true?()
- 单项选择题 Whichstatementistrue?()
- 多项选择题 Whichtwodemonstratean“isa”relationship?()
- 多项选择题 public class MethodOver { public void setVar (int a, int b, float c) { } } Which two overload the setVar method?()
- 多项选择题 public class ConstOver { public ConstOver (int x, int y, int z) { } } Which two overload the ConstOver constructor? ()
- 单项选择题 public class test { public static void add3 (Integer i){ int val = i.intValue ( ); val += 3; i = new Integer (val); } public static void main (String args [ ] ) { Integer i = new Integer (0); add3 (i); system.out.printIn (i.intValue ( ) ); } } What is the result?()
- 填空题 Public class test ( Public static void stringReplace (String text) ( Text = text.replace („j„ , „i„); ) public static void bufferReplace (StringBuffer text) ( text = text.append (“C”) ) public static void main (String args ){ String textString = new String (“java”); StringBuffer text BufferString = new StringBuffer (“java”); stringReplace (textString); BufferReplace (textBuffer); System.out.printIn (textString + textBuffer); } ) What is the output?()