网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
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?()
- 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”
参考答案
更多 “ 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?()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”” 相关考题
考题
下列程序段的输出结果是【 】。public class Test {void printValue(int m) {do {System.out.println("The value is"+m);}while (--m>10);}public static void main (String args[]) {int i=10;Test t= new Test();t.printValue(i);}}
考题
下面代码段的输出结果为( )。 public class Test { public static void main(String sss[]) { int i=0xFFFFFFFl; int j=~i; } }A.0B.1C.14D.-15
考题
下面程序段的输出结果是( )。 public class Test { public static void main ( String[] args) { int result=0; for ( int i=1;i<=5;i++) { if ( i%2==0 ) continue; result + =i; } System. out. println ("result is " + result ); } }A.result is 7B.result is 8C.result is 9D.result is 10
考题
下面程序的输出结果是什么? class C1{ static int j=0; public void method(int a){ j++; } } class Test extends C1{ public int method(){ return j++; } public void result(){ method(j); System.out.println(j+method()); } public static void main(String args[]){ new TeA.0B.1C.2D.3
考题
下列程序的执行结果是 ( ) public class Test { public int aMethod() { satic int i=0; i++; System.out.println(i); } public static void.main(String args[]) { Test test=new Test(); test.aMethod(); }A.编译错误B.0C.1D.运行成功,但不输出
考题
下列代码的执行结果是public class Test{ public int aMethod(){ static int i=0; i++; System.out.println(i); } public static void main(String args[]){ Test test= new Test(); test. aMethod(); }}A.编译错误B.0C.1D.运行成功,但不输出
考题
在下面程序的下画线处应填入的选项是 public class Test______{ public static void main(String args[]) { Test t=new Test(); Thread tt=new Thread(t); tt.start(); } public void run() { for(int i=0;i<5;i++) System.out.println("i="+i); } }A.implements RunnableB.extends ThreadC.implements ThreadD.extends Runnable
考题
下列程序输出结果为( )。public class test { public static void main(String args[]) { int a=0; outer: for(int i=0;i<2;i++) { for(int j=0;j<2;j++) { if(j>i) { continue outer; } a++; } } System.out.println(a); }}A.0B.2C.3D.4
考题
下列程序执行后,j的值是( )。 public class Test { public static void main(String args[]) { int j=1; for(int i=7;i>0;i-=2) j*=2; System.out.println(j); } }A.15B.1C.32D.16
考题
下列程序输出结果为( )。 public class test { public static void main (String args[]) { int a=0; outer:for(int i=0;i<2;i + +) { for(int j=0;j<2;j+ +) { if(j>i) { continue outer; } a+ +; } } System.out.println(a); } }A.0B.2C.3D.4
考题
下列代码的执行结果是( )。public class Test{public int aMethod( ){static int i=0;i++;System.out.println(i):}public static void main (String args[]){Trest test=new Test ( );test aMethod( ):}}A.编译错误B.0C.1D.运行成功,但不输出B.C.D.
考题
下列代码中,将引起一个编译错误的行是( )。 1)public class Test{ 2)int m,n; 3)public Test{} 4)public Test(int a){m=a;) 5)public static void main(String args[]){ 6)Test tl,t2; 7)int j,k; 8)j=0;k=0; 9)tl=new Test; 10)t2=new Test(j,k); 11)} 12)}A.第3行B.第5行C.第6行D.第l0行
考题
下列代码的执行结果是 public class Test{ public int aMethod( ) { static int i=0; i+ +; System.out.println(i); } public static void main(String args[ ]){ Test test = new Test( ); test.aMethod( ); } }A.编译错误B.0C.1D.运行成功,但不输出
考题
下列语句执行后,i的值是( )。 public class Test { public static void main(String[ ] args) { int i =0; for(int j=10; j>5i<5; j-=3,i+=2) i=i+j; System.out.println(i); } }A.8B.9C.10D.12
考题
以下程序的运行结果为:public class test {public static void main(String args[]) {int i=0, j=2;do {i=++i;j--;} while(j>0);System.out.println(i);}}
A. 0B. 1C. 2D.3
考题
( 30 )在程序的下划线处应填入的选项是public class Test _________{public static void main(String args[]){Test t = new Test();Thread tt = new Thread(t);tt.start();}public void run(){for(int i=0;i5;i++){system.out.println( " i= " +i);}}}A ) implements RunnableB ) extends ThreadC ) implements ThreadD ) extends Runnable
考题
public class test ( public static void main (String args) { int i = 0xFFFFFFF1; int j = ~i; } ) What is the decimal value of j at line 5?()A、 0B、 1C、 14D、 –15E、 An error at line 3 causes compilation to fail.F、 An error at line 4 causes compilation to fail.
考题
public class Test { public static void main(String Args[]) { int i =1, j = 0; switch(i) { case 2: j +=6; case 4: j +=1; default: j +=2; case 0: j +=4; } System.out.println(“j =” +j); } } What is the result? () A、 0B、 2C、 4D、 6E、 9F、 13
考题
public class Test { public static void leftshift(int i, int j) { i=j; } public static void main(String args[]) { int i = 4, j = 2; leftshift(i, j); System.out.printIn(i); } } What is the result?() A、 2B、 4C、 8D、 16E、 The code will not compile.
考题
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.println(j); } } What is the result?() A、 0B、 1C、 2D、 Compilation fails.
考题
public class test ( private static int j = 0; private static boolean methodB(int k) ( j += k; return true; ) public static void methodA(int i)( boolean b: b = i 10 | methodB (4); b = i 10 || methodB (8); ) public static void main (String args[])( methodA (0); system.out.printIn(j); ) ) What is the result?() A、 The program prints “0”B、 The program prints “4”C、 The program prints “8”D、 The program prints “12”E、 The code does not complete.
考题
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?()A、 Compilation will fail.B、 The program prints “0”.C、 The program prints “3”.D、 Compilation will succeed but an exception will be thrown at line 3.
考题
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? ()A、 Compilation succeeds.B、 An error at line 2 causes compilation to fail.C、 An error at line 9 causes compilation to fail.D、 An error at line 10 causes compilation to fail.E、 An error at line 11 causes compilation to fail.
考题
单选题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? ()A
Compilation succeeds.B
An error at line 2 causes compilation to fail.C
An error at line 9 causes compilation to fail.D
An error at line 10 causes compilation to fail.E
An error at line 11 causes compilation to fail.
考题
单选题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.println(j); } } What is the result?()A
0B
1C
2D
Compilation fails.
考题
单选题public class Test { public static void leftshift(int i, int j) { i=j; } public static void main(String args[]) { int i = 4, j = 2; leftshift(i, j); System.out.printIn(i); } } What is the result?()A
2B
4C
8D
16E
The code will not compile.
考题
单选题public class test ( private static int j = 0; private static boolean methodB(int k) ( j += k; return true; ) public static void methodA(int i)( boolean b: b = i 10 | methodB (4); b = i 10 || methodB (8); ) public static void main (String args[])( methodA (0); system.out.printIn(j); ) ) What is the result?()A
The program prints “0”B
The program prints “4”C
The program prints “8”D
The program prints “12”E
The code does not complete.
热门标签
最新试卷