更多"下列程序的输出结果是( )。 public class Test"的相关试题:
[单项选择]下面程序段的输出结果是( )。
public class Test
public static void main (String[] args)
for ( int a=0;a<10;a++)
if (a==5) break;
System.out.println(
A. ;
[单项选择]下面代码段的输出结果为( )。
public class Test
public static void main(String sss[])
int i=0xFFFFFFFl;
int j=~i;
A. 0
B. 1
C. 14
D. -15
[单项选择]下面程序的输出结果是
public class Test
public static void main(String[] args)
int[]array=2,4,6,8,10;
int size=6;
int result=-1:
try
for(int i=0;i<size&&result==-1;i++)
if(array[i]==20)result=i;
catch(ArithmeticException e)
System.out.println("Catch---1");
catch(ArrayIndexOutOfBoundsException e)
System.out.println("Catch---2");
catch(Exception e)
System.out.println("Catch---3");
A. Catch---1 B) Catch一--2 C) Catch---3 D) 以下都不对
[单项选择]下面程序段的输出结果是
public class Test
public static void main(String args[])
int n=5,sum=0;
while(n>0)
sum+=n;
--n;
System.out.println("sum is"+sum);
A. sum is 14
B. sum is 15
C. sum is 10
D. sum is 5
[单项选择]下面程序段的输出结果是
public class Test
public static void main(String args[])
int x,y;
x=(int)Math.sqrt(5)/2+(int)Math.random( )*5/2;
y=(int)Math.sqrt(3)/2+(iht)Math.random( )*3/2;
if(x>y)
System.out.println("x>y");
else if (x==y)
System.out.println("x=y");
else
System.out.println("x<y");
A. x>y
B. x=y
C. x<y
D. 编译错误
[单项选择]下面程序段的输出结果是
public class Test
public static void main(String args[])
int[] a=new int[11];
int[] p=new int[4];
int k=5;
for(int i=1;i<=10;i++)
a[i]=i;
for(int i=l;i<=3;i++)
p[i]=a[i*i];
for(int i=1;i<=3;i++)
k=k+p[i]*2;
System.out.println(k);
A. 37
B. 31
C. 33
D. 35
[单项选择]执行下面程序后输出的正确结果是
Public class Test
public static void main(String args[])
byte x=3,y=4;
long r=80L;
System.out.print(r/y);
System.out.print(”,”);
System.out.print(x/y);
A. 20.0,1
B. 20.0,1.0
C. 20,0
D. 20,1.0
[单项选择]执行下面程序后输出的正确结果是
public class Test
public static void main(String args[])
byte x=3,y=4;
long r=80L;
System.out.print(r/y);
System.out.print(",");
System.out.print(x/y);
A. 20.0,1
B. 20.0,1.0
C. 20,0
D. 20,1.0
[单项选择]执行下面程序后输出的正确结果是
public class Test
public static void main(String args[])
System.out.print(100%3);
System.out.print(",");
System.out.print(100%3.0);
A. 1,1
B. 1,1.0
C. 1.0,1
D. 1.0,1.0
[单项选择]下列程序的输出结果是( )。
public class Test
public static void main (String[] args)
String s="hello";
s.replace ('r','m');
System.out.println(s);
A. hello
B. HELLO
C. hemmo
D. HEMMO
[单项选择]下面程序段的输出结果是( )。
public class TeSt
public static voidmain(Stringargs[])
int[]a=new int[11];
int[]p=new int[4];
intk=5;
for(int i=1;i<=10;i++)
a[i]=i;
for(inti=1;i<=3;i++)
p[i]=a[i*i];
for(inti=1;i<=3;i++)
k=k+p[i]*2;
System.out.println(k);
A. 37
B. 31
C. 33
D. 35
[单项选择]下面程序段的输出结果是( )。
public class Test t
public static void main(String[] args)
int x=0;
for (int i=1;i<=4;i++)
x=4;
for(int j=1;j<=3; j++)
x=3;
for(int k=1; k<=2; k++) x=x+6;
System. out. println (x);
A. 36
B. 48
C. 144
D. 15
[单项选择]如下程序的输出结果是( )。
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);
A. The value is 8
B. The value is 9
C. The value is 10
D. The value is 11