A. 5
B. x=5
C. "x="+5
D. "x="5
第1题:
( 8 )阅读下列代码
public class Test2{
public static void main(String args[]){
System.out.println(5/2);}}
其执行结果是 【 8 】 。
第2题:
下面程序段的输出结果是( )。 public class Test { public static void main (String[] args) { for ( int a=0;a<10;a++) { if (a==5) break; System.out.println(A); } } }
A.01234
B.6789
C.012346789
D.5
第3题:
请在下划线处填入代码,是程序正常运行并且输出 “ Hello! ”
Class Test 【 15 】 {
Public static void main (String[] arge){
Test t = new Test();
t.start();
}
Public void run(){
System.out.println( “ Hello! ” );
}
第4题:
阅读下面程序 public class Test3 { public static void main(String[] args) { int x=3,y=4,z=5; String s="xyz": System.out.println(s+x+y+z); } } 程序运行的结果是
A.xyz12
B.xyz345
C.xyzxyz
D.12xyz
第5题:
执行下面程序段的输出结果为( )。 public class Q { public static void main(String argv[]) { int anar[]一new int[5]; System.out.println(anar[0]); } }
A.0
B.1
C.2
D.5
第6题:
下列程序的输出结果是( )。 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
第7题:
A.12
B.012
C.10
D.3
第8题:
A. hello
B. hello2
C. 编译报错
D. 运行报错,不能将串与整数相加
第9题:
A. 输出结果为 0
B. 运行出错
C. 输出结果为 null
D. 编译错误
第10题:
执行以下代码,输出结果的结果是? () public class Test{ public String[] ss = new String[5]; public static void main(String[] args){ System.out.println(ss[1]); } }
第11题:
Which declarations will allow a class to be started as a standalone program?()
第12题:
null
-1
编译时出错
运行时报错
第13题:
阅读下面程序
public class Test3{
public static void main(String args[]){
int x=3,y=4,z=5;
String s= " xyz " ;
System.out.println(s+x+y+z);
}
}
程序运行的结果是
A)xyz12
B)xyz345
C)xyzxyz
D)12xyz
第14题:
下面程序的输出结果为( )。 public class Test { public static void main (String args[]) { String X="ABCD"; String Y="EFG"; X=X.substring (X.length()-Y.length()); System.out.println(X); } }
A.ABC
B.BCD
C.EFG
D.ABCDEFG
第15题:
阅读下面代码: public class Test2005 { public static void main(String args[]) { System.out.println((3>2)? 4:5); } } 其运行结果是
A.2
B.3
C.4
D.5
第16题:
执行下面程序,显示的结果为( )。 public class Test { public static void main (String args[]) { Test t=newTest(); System.out.println (Loverload ("2","3")); } int overload (intx,int y) {return x+y;} String overload (String x,Stnng y){return x+y;} }
A.2
B.3
C.5
D.23
第17题:
下列程序的执行结果是( )。 public class Test { public static void main(String args[]) { System.out.println(5/2); } }
A.2.5
B.2
C.2.5
D.2
第18题:
A. goodmorning
B. "good"+"morning"
C. good morning
D. good+morning
第19题:
A. 7
B. 6
C. 5
D. 8
第20题:
以下程序调试结果为:
public class Test {
int m=5;
public void some(int x) {
m=x;
}
public static void main(String args []) {
new Demo().some(7);
}
}
class Demo extends Test {
int m=8;
public void some(int x) {
super.some(x);
System.out.println(m);
}
}
A.5
B.8
C.7
D.无任何输出
E.编译错误
第21题:
A. 输出结果为:0
B. 无输出
C. 编译错误
D. 输出null
第22题:
阅读以下代码: public class Test{ public static void main(){ System.out.println(“x=”+x); } } 请问,代码运行的结果是?()
第23题:
x
x=x
“x=”+5
编译报错