单项选择题
class super (
public int I = 0;
public super (string text) (
I = 1
)
)
public class sub extends super (
public sub (string text) (
i= 2
)
public static void main (straing args) (
sub sub = new sub (“Hello”);
system.out. PrintIn(sub.i);
)
)
What is the result?()
A. Compilation will fail.
B. Compilation will succeed and the program will print “0”
C. Compilation will succeed and the program will print “1”
D. Compilation will succeed and the program will print “2”
点击查看答案
相关考题
- 单项选择题 byte arry1, array2; byte array3 ; byte array4; If each array has been initialized, which statement will cause a compiler error?()
- 单项选择题 Whichdeclarationpreventscreatingasubclassofanouterclass?()
- 单项选择题 class super { public float getNum() {return 3.0f;} } public class Sub extends Super { } Which method, placed at line 6, will cause a compiler error?()
- 单项选择题 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?()