File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

help me for these questions

 
zhou chuanhong
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).


 
Sivalingam Sivasuthan
Ranch Hand
Posts: 75
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi zhou chuanhong:
I think the answers would be........
1)
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)
b) Call paint() from within update()

3)

a) Programmable painting support classes
(I am not sure about this)

4)
b) Running User threads prevent a JVM from terminating program
e) The JVM can terminate program when only daemon threads are running

Siva.
 
ASHISH KUMAR
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI ZHOU & SIVALINGAM,
ANSWERS FOR ZHOU'S QUESTIONS ARE
1. D
2. C
3. B
D. BE
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic