Baz has the value of “”
Baz has the value of null
Baz has the value of “red”
Baz has the value of “blue”
Bax has the value of “green”
The program throws an exception.
第1题:
下列程序的运行结果是【 】。
public class Test {
public static void main (String args[]) {
String s1="hello!";
System.out.println (s1.toUpperCase());
}}
第2题:
( 8 )阅读下列代码
public class Test2{
public static void main(String args[]){
System.out.println(5/2);}}
其执行结果是 【 8 】 。
第3题:
下列程序段的输出结果是【 】。
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);
}
}
第4题:
下列代码的执行结果是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.0
C.1
D.运行成功,但不输出
第5题:
A.t.f
B.this.n
C.Test.m
D.Test.n
第6题:
下列代码的执行结果是( )。 public class Test { public static void main(String args[]) { System.out.println(7/2); } }
A.3.5
B.3
C.3.0
D.3.50
第7题:
请在下划线处填入代码,是程序正常运行并且输出 “ Hello! ”
Class Test 【 15 】 {
Public static void main (String[] arge){
Test t = new Test();
t.start();
}
Public void run(){
System.out.println( “ Hello! ” );
}
第8题:
下列语句输出结果为( )。public class test{public static void main(String args[]){byte b=OXA;System.out.println(b);}}
A.OXA
B.A
C.1
D.10
第9题:
下面程序的输出结果是什么? 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 Te
A.0
B.1
C.2
D.3
第10题:
以下程序调试结果为:
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.编译错误