网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
单选题
现有:class Test2 fpublic static void main (String [] args) {short a,b,C;a=1;b=2;C=a+b;a+=2;}}以上代码中,哪一句是错误的?()
A
a=1;
B
C=a+b;
C
a+=2;
D
shorta,b,C;
参考答案
参考解析
解析:
暂无解析
更多 “单选题现有:class Test2 fpublic static void main (String [] args) {short a,b,C;a=1;b=2;C=a+b;a+=2;}}以上代码中,哪一句是错误的?()A a=1;B C=a+b;C a+=2;D shorta,b,C;” 相关考题
考题
执行下列程序段之后,输出的结果是( )。public class Test{ public static void main(String[ ] args) { byte a = 2; short b = 3; long c = 4; c=a%b*4%b; System.out.println(c) ; } }A.2B.1C.-1D.-2
考题
阅读下列代码段,选出该代码段的正确文件名( )。 class A { void method1() { System.out.println("method1 in class A"); } } public class B { void method2() { System.out.println("method2 in class B"); } public static void main(String args[]) { System.out.println("main in class B"); } }A.A.javaB.A.classC.B.classD.B.java
考题
( 8 )阅读下列代码public class Test2{public static void main(String args[]){System.out.println(5/2);}}其执行结果是 【 8 】 。
考题
下列代码的执行结果是( )。 public class Test{ public static void main (String args[ ]){ System.out.println(5/2): } }A.2.50B.2C.2.5D.2.0
考题
现有:classTest2fpublicstaticvoidmain(String[]args){shorta,b,C;a=l;b=2;C=a+b;a+=2:}以上代码中,哪一句是错误的?()
A.a=1:B.C=a+b;C.a+=2;D.shorta,b,C;
考题
下列代码的执行结果为( )。 public class Testl{ public static void main (String args[]){ int a=3,b=10: System.out.println((a+ +)*(-b)); }A.40B.36C.30D.27
考题
下列代码的执行结果是 ( )public class Test2{public static void main(String args[]){int a=4,b=6,c=8;String s="abc";System.out.println(a+b+s+c);}}A.ababccB.464688C.46abc8D.10abc8
考题
下列程序运行的结果是______。 public class ex22 { public static void main(String[] args) { int a=0,b=l; do{ if(b%2==0) a+=b; b++; }while(b<=100); System.out.println(a); } }A.5050B.2550C.2525D.2500
考题
执行下列程序段之后,输出的结果是______。 public class Test8 { public StatiC void main (String[] args) { byte a=2; short b=3; long c=4; c=a%b*4%b; System.out.println (c); } }A.2B.1C.-2D.-1
考题
下列程序的输出结果是class Test{public static void main(String args[]){int n=7;n
下列程序的输出结果是 class Test{ public static void main(String args[]){ int n=7; n<<=3; n=nn+1|n+2^n+3; n>>=2; System.out.println(n); } }A.0B.-1C.14D.64
考题
下面代码的运行结果是 public class Test{ public static void main(String args[]){ for(int i=0; i<3;i++){ if(i<2) continue; System.out.println(i); } } }A.0B.1C.2D.3
考题
下面程序代码运行结果为( )。 import java.awt.*; public class Test { public static void main (String args[]) { String s1="a+b+c"; String s2="+"; int i=s1.lastIndexOf (s2); System.out.println(i); } }A.0B.1C.2D.3
考题
阅读下面程序 public class Test2 { public static void main(String args[]){ int a=1O, b=4, c=20, d=6; System.out.println(a++*b+c*--D) ; } } 程序运行的结果是A.144B.160C.140D.164
考题
下列程序运行后的输出结果是( )。 public class Sun { public static void main(String args[ ]) { int a,b; a=0; b=0; for(int m=1;m<=10;m++) { a=a+1; b=0; for(int j=1;j<=10;j++) { a=a+1; b=b+2; } } System.out.println(a+","+B) ; } }A.10,20B.20110C.110,20D.200110
考题
下列程序的输出结果是______。 public class exl5 { public static void main(String[] args) { int a=2, b=8,c=12; a1: while( a<--c } { a2: do { a+=c; if (c==b++) { continue a1; } }while (true); } System.out.print (a); } }A.52B.46C.38D.0
考题
下列代码的执行结果是( )。 public,class Test1 { public static void main(String args[]) { System.out.println(5/2); } }A.2.5B.2.0C.2.50D.2
考题
下列程序输出结果为( )。 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 Sun { public static void main(String args[ ]) { int x=1,a=0,b=0; switch(x) { case 0:b++; case 1:a++; case 2: a++; b++; } System.out.println("a="+a+","+"b="+B) ; } } 该程序的输出结果是( )。A.a=2,b=1B.a=1,b=1C.a=1,b=0D.a=0,b=0
考题
下列程序的运行结果是( )。 public class Sun { public static void main(String args[]) { int a=1; int b=1; for(int i=1;i<=3;i++) { a=a+b; b=b+a; } System.out.println(a+" "+b); } }A.66B.5 8C.13 21D.34 55
考题
Which declarations will allow a class to be started as a standalone program?() A、public void main(String args[])B、public void static main(String args[])C、public static main(String[] argv)D、final public static void main(String [] array)E、public static void main(String args[])
考题
现有: class Test2 f public static void main (String [] args) { boolean X= true; boolean y=false; short Z=20; if((x==true) & (y=true)) z++; if((y==true) || (++z==22)) z++; System. out .println( "z="+z); } 结果是什么?() A、Z=21B、Z=22C、Z=23D、Z= 24
考题
package test1; public class Test1 { static int x = 42; } package test2; public class Test2 extends test1.Test1 { public static void main(String[] args) { System.out.println(“x = “ + x); } } What is the result?() A、 x = 0B、 x = 42C、 Compilation fails because of an error in line 2 of class Test2.D、 Compilation fails because of an error in line 3 of class Test1.E、 Compilation fails because of an error in line 4 of class Test2.
考题
现有:class Test2 fpublic static void main (String [] args) {short a,b,C;a=1;b=2;C=a+b;a+=2;}}以上代码中,哪一句是错误的?()A、a=1;B、C=a+b;C、a+=2;D、shorta,b,C;
考题
public class Test { public static void main (String[]args) { String foo = args[1]; String bar = args[2]; String baz = args[3]; System.out.printIn(“baz = ” + baz); } } And the output: Baz = 2 Which command line invocation will produce the output?() A、 Java Test 2222B、 Java Test 1 2 3 4C、 Java Test 4 2 4 2D、 Java Test 4 3 2 1
考题
现有: class Test2 f public static void main (String [] args) { short a,b,C; a=l; b=2; C=a+b; a+=2: } 以上代码中,哪一句是错误的?() A、a=1:B、C=a+b;C、a+=2;D、short a,b,C;
考题
单选题现有: class Test2 f public static void main (String [] args) { short a,b,C; a=l; b=2; C=a+b; a+=2: } 以上代码中,哪一句是错误的?()A
a=1:B
C=a+b;C
a+=2;D
short a,b,C;
考题
单选题package test1; public class Test1 { static int x = 42; } package test2; public class Test2 extends test1.Test1 { public static void main(String[] args) { System.out.println(“x = “ + x); } } What is the result?()A
x = 0B
x = 42C
Compilation fails because of an error in line 2 of class Test2.D
Compilation fails because of an error in line 3 of class Test1.E
Compilation fails because of an error in line 4 of class Test2.
热门标签
最新试卷