JAVA题库:格林模拟试题三(下)(8)
文章作者 100test 发表时间 2007:03:14 17:37:51
来源 100Test.Com百考试题网
question 55)
what will happen when you attempt to compile and run the following code?
public class agg{
static public long i=10.
public static void main(string argv[]){
switch(i){
default:
system.out.println("no value given").
case 1:
system.out.println("one").
case 10:
system.out.println("ten").
case 5:
system.out.println("five").
}
}
}
1) compile time error
2) output of "ten" followed by "five"
3) output of "ten"
4) compilation and run time error because of location of default
question 56)
given the following class
public class zeroprint{
public static void main(string argv[]){
int i =0.
//here
}
}
which of the following lines if placed after the comment //here will print out 0.
1) system.out.println(i ).
2) system.out.println(i 0 ).
3) system.out.println(i).
4) system.out.println(i--).