2024年4月2日发(作者:)
java程序员认证考试试题
java程序员认证考试试题
Java具有简单性、面向对象、分布式、健壮性、安全性、平台的'
独立与可移植性、多线程、动态性等特点。下面是店铺整理的关于
java程序员认证考试试题,欢迎大家参考!
statement about the garbage collection mechanism
are true?
A. Garbage collection require additional programe code in
cases where multiple threads are running.
B. The programmer can indicate that a reference through a
local variable is no longer of interest.
C. The programmer has a mechanism that explicity and
immediately frees the memory used by Java objects.
D. The garbage collection mechanism can free the memory
used by Java Object at explection time.
E. The garbage collection system never reclaims memory
from objects while are still accessible to running user threads.
2. Give the following method:
1) public void method( ){
2) String a,b;
3) a=new String(“hello world”);
4) b=new String(“game over”);
5) n(a+b+”ok”);
6) a=null;
7) a=b;
8) n(a);
9) }
In the absence of compiler optimization, which is the earliest
point the object a refered is definitely elibile to be garbage
collection.
A. before line 3
line 5
C. before line 6
line 7
E. Before line 9
3. In the class nt,which is the parent class
upon which jdk1.1 awt events are based there is a method called
getID which phrase accurately describes the return value of this
method?
A. It is a reference to the object directly affected by the cause
of the event.
B. It is an indication of the nature of the cause of the event.
C. It is an indication of the position of the mouse when it
caused the event.
D. In the case of a mouse click, it is an indication of the text
under the mouse at the time of the event.
E. It tells the state of certain keys on the keybord at the time
of the event.
F. It is an indication of the time at which the event occurred.
4. Which statement about listener is true?
A. Most component allow multiple listeners to be added.
B. If multiple listener be add to a single component, the event
only affected one listener.
C. Component don?t allow multiple listeners to be add.
D. The listener mechanism allows you to call an
addXxxxListener method as many times as is needed, specifying
as many different listeners as your design require.
the following code:
public class Example{
public static void main(String args[] ){
int l=0;
do{
n(“Doing it for l is:”+l);
}while(--l>0)
n(“Finish”);
}
}
Which well be output:
A. Doing it for l is 3
B. Doing it for l is 1
C. Doing it for l is 2
D. Doing it for l is 0
E. Doing it for l is ?C1
F. Finish
6. Give the code fragment:
1) switch(x){
2) case 1:n(“Test 1”);break;
3) case 2:
4) case 3:n(“Test 2”);break;
5) default:n(“end”);
6) }
which value of x would cause “Test 2” to the output:
A. 1
B. 2
C. 3
D. default
7. Give incompleted method:
1)
2) { if(unsafe()){//do something…}
3) else if(safe()){//do the other…}
4) }
The method unsafe() well throe an IOException, which
completes the method of declaration when added at line one?
A. public IOException methodName()
B. public void methodName()
C. public void methodName() throw IOException
D. public void methodName() throws IOException
E. public void methodName() throws Exception
8. Give the code fragment:
if(x>4){
n(“Test 1”);}
else if (x>9){
n(“Test 2”);}
else {
n(“Test 3”);}
Which range of value x would produce of output “Test 2”?
A. x<4
B. x>4
C. x>9
D. None
9. Give the following method:
public void example(){
try{
unsafe();
n(“Test1”);
}catch(SafeException e){n(“Test 2”);
}finally{n(“Test 3”);}
n(“Test 4”);
Which will display if method unsafe () run normally?
A. Test 1
B. Test 2
C. Test 3
D. Test 4
10. Which method you define as the starting point of new
thread in a class from which new the thread can be excution?
A. public void start()
B. public void run()
C. public void int()
D. public static void main(String args[])
E. public void runnable()
the following class definition:
class A{
protected int i;
A(int i){
this.i=i;
}
}
which of the following would be a valid inner class for this
class?
Select all valid answers:
A. class B{
}
B. class B extends A{
}
C. class B extends A{
B(){n(“i=”+i);}
}
D. class B{
class A{}
发布者:admin,转转请注明出处:http://www.yc00.com/news/1712041493a1995344.html
评论列表(0条)