16 class Boochy 17 Snoochy snooch 18 public BoochySnoochy s snooch s 19 And the

16 class boochy 17 snoochy snooch 18 public

This preview shows page 113 - 117 out of 120 pages.

16. class Boochy { 17. Snoochy snooch; 18. public Boochy(Snoochy s) { snooch = s; } 19. } And the statements: 21. public static void main(String[] args) { 22. Snoochy snoog = new Snoochy(); 23. snoog = null; 24. // more code here 25. } Which statement is true about the objects referenced by snoog, snooch, and booch immediately after line 23 executes? A. None of these objects are eligible for garbage collection. B. Only the object referenced by booch is eligible for garbage collection. C. Only the object referenced by snoog is eligible for garbage collection. D. Only the object referenced by snooch is eligible for garbage collection. E. The objects referenced by snooch and booch are eligible for garbage collection. Answer: E Question 212 Given: 1. public class GC { 2. private Object o; 3. private void doSomethingElse(Object obj) { o = obj; } 4. public void doSomething() { 5. Object o = new Object(); 6. doSomethingElse(o); 7. o = new Object();
Image of page 113
8. doSomethingElse(null); 9.o=null; 10. } 11. } When the doSomething method is called, after which line does the Object created in line 5 become available for garbage collection? A. Line 5 B. Line 6 C. Line 7 D. Line 8 E. Line 9 F. Line 10 Answer: D Question 213 Which two are true? (Choose two.) A. A finalizer may NOT be invoked explicitly. B. The finalize method declared in class Object takes no action. C. super.finalize() is called implicitly by any overriding finalize method. D. The finalize method for a given object will be called no more than once by the garbage collector. E. The order in which finalize will be called on two objects is based on the order in which the two objects became finalizable. Answer: BD Question 214 A class games.cards.Poker is correctly defined in the jar file Poker.jar. A user wants to execute the main method of Poker on a UNIX system using the command: java games.cards.Poker What allows the user to do this? A. put Poker.jar in directory /stuff/java, and set the CLASSPATH to include /stuff/java B. put Poker.jar in directory /stuff/java, and set the CLASSPATH to include /stuff/java/*.jar C. Put Poker.jar in directory /stuff/java, and set the CLASSPATH to include /stuff/java/Poker.jar D. put Poker.jar in directory /stuff/java/games/cards, and set the CLASSPATH to include /stuff/java E. put Poker.jar in directory /stuff/java/games/cards, and set the
Image of page 114
CLASSPATH to include /stuffijava/*.jar F. put Poker.jar in directory /stuff/java/games/cards, and set the CLASSPATH to include /stuff/java/Poker.jar Answer: C Question 215 Click the Exhibit button. Given the fully-qualified class names: com.foo.bar.Dog com.foo.bar.blatz.Book com.bar.Car com.bar.blatz.Sun Which graph represents the correct directory structure for a JAR file from which those classes can be used by the compiler and JYM? A. Jar A B. Jar B C. Jar C D. Jar D E. Jar E Answer: A
Image of page 115
Question 216 A developer is creating a class Book that needs to access class Paper.
Image of page 116
Image of page 117

You've reached the end of your free preview.

Want to read all 120 pages?

  • Spring '17
  • jane
  • Madrid Metro, Metropolitana di Napoli, class a, Osaka Municipal Subway, public static void

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture