更多"下列程序执行之后,将输出 public class exl9 "的相关试题:
[单项选择]执行下面程序段,屏幕上将输出( )。
public class Test
private int x=10,y=20;
public Test (int x,int y)
System.out.println (x+this.x);
System.out.println (y+y);
public static void main (String[] args)
Testt= new Test(30,50);
A. 无输出
B. 20
C. 40
D. 40
[单项选择]执行下面程序段,屏幕上将输出( )。 public class Test { private int x=10,y=20; public Test (int x,int y) { System.out.println (x+this.x); System.out.println (y+y); } public static void main (String[] args) { Testt= new Test(30,50); } }
A. 无输出
B. 20 40
C. 40 100
D. 40 70
[单项选择]下列程序执行之后,输出的结果是______。 public class exl0 { public static void main(String[] args) { int j=0; a1: for (int i=3;i>0; i--) { j+=i; a2: for (int k=l; k<3; k++) { j*=k; if(i==k) break a1; } } System.out.println(j); } }
A. 18
B. 16
C. 14
D. 0
[单项选择]下列程序执行之后,输出的结果是______。 public class ex4 { public static void main(String[] args) { int j=0; for(int i=3;i>0;i--) { j+=i; int x=2; while(x<j) { x+=1; System.out,print(x); } } } }
A. 3555
B. 35556666
C. 33453456
D. 345
[单项选择]执行如下程序:
public class Test
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=1
B. a=1,b=1
C. a=1,b=0
D. a=2,b=2
[单项选择]下列程序执行后,j的值是 public class Testggg public static void main(String args[ ]) int j=1; for(int i=7;i>0;i-=2) j * =2; System.out.println(j);
A. 15
B. 1
C. 32
D. 16
[单项选择]执行下列程序段之后,变量b的值为( )。
public class Test
public static void main (String[] args)
int i = 12;
int j = 24;
boolean b1 = true;
booleanb=(j%i==0)&&(! b1) || (j/i! =2);
System. out. println (b);
A. true
B. false
C. 0
D. 1
[单项选择]下列程序执行后,m的值是 public class Testbbb public static void main (String args[ ]) int a=10,b=3,m=5; if(a= =B) m + =a; else m:+ +a*m; System.out.println(m);
A. 15
B. 50
C. 55
D. 5
[单项选择]下列程序执行后,k的值是 public class Testddd public static void main(String args[ ]) inti;10,j=18 K=30; switch(j-i) case 8:k++; case 9:k+ =2; case 10:k+ =3; default:k/=j; System.out.println(k);
A. 31
B. 32
C. 2
D. 33
[单项选择]下列程序的执行结果是 public class Testhh public static void main(String args [] ) Strings1=new String("I am boy"); Strings2=new String("I am boy"); System.out.println(s1.equals(s2));
A) true
B) falseC) I am boy D) 都不正确
[单项选择]执行下列程序段之后,变量b的值为( )。 public class Test { public static void main (String[] args) { int i = 12; int j = 24; boolean b1 = true; booleanb=(j%i==0)&&(! b1) || (j/i! =2); System. out. println (b); } }
A. true
B. false
C. 0
D. 1
[单项选择]执行下列程序之后,变量n的值为( )。
public class Test
publie static void main (String[] args)
int y=2;
int z=3;
int n=4;
n=n+ -y * z/n;
System. out. println (n);
A. 3
B. -1
C. -12
D. -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. 0
C. 1
D. 运行成功,但不输出
[单项选择]执行下面程序后,结果是 public class Testrr public static void main(String args[]) int i=0xFFFFFFF1; int j=-i; System.out.println("j="+j); A) j=-15 B) j=-16C) j=16
D) j=15
[单项选择]下面程序执行后,输出的结果是( )。
public class Test
public static void main (String[] )args)
boolean m=true;
if(m==false) System.out.println("假");
else
if(m====true) System.out.println("真");
else System.out.println ("错误");
A. 真
B. 假
C. 错误
D. 编译出错
[单项选择]下列程序执行后,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. 15
B. 1
C. 32
D. 16
[单项选择]下列程序执行后,屏幕上显示的应是
public class Testyyy
public static void main(String[]args)
char charl[]=,’t’ ’e’’s],’t’;
char char2[]=’t’,’e’,’s’,’t’,’1’;
String s1=new String(char1);
String s2=new String(char2,0,4);
System.out.println(s1.equals(s2));
A. true
B. false
C. test
D. 编译错误