zhou chuanhong

Greenhorn
+ Follow
since Feb 14, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by zhou chuanhong

You can refer Java Language Specification
Second Edition
5.5

If S is a class type:
If T is a class type, then S and T must be related classes-that is, S and T must be the same class, or S a subclass of T, or T a subclass of S; otherwise a compile-time error occurs.
If T is an interface type:
If S is not a final class (��8.1.1), then the cast is always correct at compile time (because even if S does not implement T, a subclass of S might).
If S is a final class (��8.1.1), then S must implement T, or a compile-time error occurs.
Hi :
I have some questions which are difficult to me. Please give a hand.
1) Given:
1.public class X {
2. public void m(Object x) {
3. x = new Integer(99);
4. Integer y = (Integer)x;
5. y = null;
6. System.out.println("x is" + x);
7. }
8.}
When is the Integer object, created in line 3, eligible for garbage collection?
A never
B just after line 4
C just after line 5
D just after line 6 (that is, as the method returns)
when the calling method sets the argument it passed into this method to null
2)The way to accumulate drawn objects on the screen is to:





a) Call paint() directly

b) Call paint() from within update()

c) Call update() from within repaint()

d) Call update() from within paint()

e) Call accumulate() from within paint()


Single Select - Please select the best answer (one and only one choice must be selected).

3)AWT components get their look and feel from:





a) Programmable painting support classes

b) Peer classes

c) SWING classes

d) JVM drawing primitives


Single Select - Please select the best answer (one and only one choice must be selected).
4)With respect to User and Daemon threads:





a) Daemon threads can not be destroyed

b) Running User threads prevent a JVM from terminating program

c) Running Daemon threads prevent a Java VM from terminating program

d) Daemon threads can not be grouped together

e) The JVM can terminate program when only daemon threads are running


Multiple Select - Please select all of the correct answers (this question has 2 correct choices).