JAVA题库:格林模拟试题二(下)(2)

文章作者 100test 发表时间 2007:03:14 17:05:42
来源 100Test.Com百考试题网


question 33)

what will happen when you attempt to compile and run this code

//demonstration of event handling
import java.awt.*.
import java.awt.event.*.
public class mywc extends frame implements windowlistener{
public static void main(string argv[]){
mywc mwc = new mywc().
}
public void windowclosing(windowevent we){
system.exit(0).
}//end of windowclosing
public void mywc(){
setsize(300,300).
setvisible(true).
}
}//end of class

1) error at compile time
2) visible frame created that that can be closed
3) compilation but no output at run time
4) error at compile time because of comment before import statements


question 34)

which option most fully describes will happen when you attempt to compile and run the following code

public class myar{
public static void main(string argv[]) {
myar m = new myar().
m.amethod().
}
public void amethod(){
static int i.
system.out.println(i).
}
}

1) compilation and output of the value 0
2) compile time error because i has not been initialized
3) compilation and output of null
4) compile time error


question 35)

which of the following will compile correctly

1) short myshort = 99s.
2) string name = excellent tutorial mr green.
3) char c = 17c.
4)int z = 015.


相关文章


谈谈Java语言的垃圾收集器
技巧显得:XML带来的好处
为Java加速——JBuilder6可视化开发环境
JAVA题库:格林模拟试题二(下)(1)
JAVA题库:格林模拟试题二(下)(2)
技巧:Java垃圾收集器使用小诀窍
SCJP考试辅导:Java的垃圾收集机制
Apache如日中天,微软奋起直追
Jcreater MotoJ2SDK的配置与使用心得
澳大利亚华人论坛
考好网
日本华人论坛
华人移民留学论坛
英国华人论坛