Java经典模拟题(onlyfortrainning)(1)
百度广告
2.考题形式:多选,单选,简答
4.考试时间:120分钟
1.which statement about the garbage collection mechanism are true?
b.the programmer can indicate that a reference through a local variable is no longer of interest.
d.the garbage collection mechanism can free the memory used by java object at expectable time.
2. give the following method:
2) string a,b;
4) b=new string("game over");
6) a=null;
system.out.println(a);
in the absence of compiler optimization, which is the earliest point the object a referred is definitely hand to be garbage collection.
3. which statement about listener is true?
b.if multiple listener be add to a single component, the event only affected one listener.
d.the listener mechanism allows you to call an addxxxlistener method as many times as is needed, specifying as many different listeners as your design require.
4.give the following code:
public static void main(string args ){
do{
}while(--l>;0)
}
which well be output:
d. doing it for l is 0e. doing it for l is –1f. finish
5. give the code fragment:
2) case 1: system.out.println("test 1");break;
4) case 3: system.out.println("test 2");break;
6) }
a. 1b. 2c. 3d. default
6. give incompleted method:
2){if(unsafe()){//do something…}
4)}
a.public ioexception methodname()
c.public void methodname() throw ioexception
e.public void methodname() throws exception
7. give the code fragment:
;4){
else if (x>;9){
else {
which range of value x would produce of output "test 2"?
;4c. x>;9d. none
8. give the following method:
try{
system.out.println("test1");
}finally{system.out.println("test 3");}
which will display if method unsafe () run normally?
9. which method you define as the starting point of new thread in a class from which new the thread can be execution?
d. public static void main(string args)e. public void runnable()
10.given the following class definition:
protected int i;
this.i=i;
}
select all valid answers:
}
}
b(){system.out.println("i="+i);}
d.class b{
}
编辑推荐:
温馨提示:因考试政策、内容不断变化与调整,长理培训网站提供的以上信息仅供参考,如有异议,请考生以权威部门公布的内容为准! (责任编辑:长理培训)
点击加载更多评论>>