单项选择题
public class Alpha1 {
public static void main( String[] args ) {
boolean flag; int i=0;
do {
flag = false;
System.out.println( i++ );
flag = i < 10;
continue;
} while ( (flag)? true:false );
}
}
What is the result?()
A. 000000000
B. 0123456789
C. Compilation fails.
D. The code runs with no output.
E. The code enters an infinite loop.
F. An exception is thrown at runtime.
相关考题
-
单项选择题
ClassOne.java:1.packagecom.abe.pkg1;2.publicclassClassOne{3.privatecharvar=‘a’;4.chargetVar(){returnvar;}5.}ClassTest.java:1.packagecom.abe.pkg2;2.importcom.abc.pkg1.ClassOne;3.publicclassClassTestextendsClassOne{4.publicstaticvoidmain(String[]args){5.chara=newClassOne().getVar();6.charb=newClassTest().getVar();7.}8.}Whatistheresult?()
A. Compilation fails.
B. Compilation succeeds and no exceptions are thrown.
C. An exception is thrown at line 5 in ClassTest.java.
D. An exception is thrown at line 6 in ClassTest.java. -
单项选择题
public class Foo { public static void main(String[] args) { try { return; } finally { System.out.println( “Finally” ); } } } What is the result?()
A. Finally
B. Compilation fails.
C. The code runs with no output.
D. An exception is thrown at runtime. -
多项选择题
Whichthreeformpartofcorrectarraydeclarations?()
A. public int a []
B. static int [] a
C. public [] int a
D. private int a [3]
E. private int [3] a []
F. public final int [] a