QUESTION 47 Given: 1. public class Batman { 2. int squares = 81; 3. public static void main(String[] args) { 4. new Batman().go(); 5. } 6. void go() { 7. incr(++squares); 8. System.out.println(squares); 9. } 10. void incr(int squares) { squares += 10; } 11. } What is the result? A. 81 B. 82 C. 91 D. 92 E. Compilation fails. F. An exception is thrown at runtime Solution : B Plus imformation : 정사각..
QUESTION 46 Which statement is true? A. A class's finalize() method CANNOT be invoked explicitly. B. super.finalize() is called implicitly by any overriding finalize() method. C. The finalize() method for a given object is called no more than once by the garbage collector. D. The order in which finalize() is called on two objects is based on the order in which the two objects became finalizable...
QUESTION 45 Given the following directory structure: bigProject |--source | |--Utils.java | |--classes |-- And the following command line invocation: javac -d classes source/Utils.java Assume the current directory is bigProject, what is the result? A. If the compile is successful, Utils.class is added to the source directory. B. The compiler returns an invalid flag error. C. If the compile is su..
QUESTION 44 A UNIX user named Bob wants to replace his chess program with a new one, but he is not sure where the old one is installed. Bob is currently able to run a Java chess program starting from his home directory /home/bob using the command: java -classpath /test:/home/bob/downloads/*.jar games.Chess Bob's CLASSPATH is set (at login time) to: /usr/lib:/home/bob/classes:/opt/java/lib:/opt/j..
QUESTION 43 Given a class Repetition: 1. package utils; 2. 3. public class Repetition { 4. public static String twice(String s) { return s + s; } 5. } and given another class Demo: 1. public class Demo { 2. public static void main(String[] args) { 3. System.out.println(twice("pizza")); 4. } 5. } Which code should be inserted at line 1 of Demo.java to compile and run Demo to print pizzapizza? A. ..
QUESTION 42 Given: 23. Object [] myObjects = { 24. new Integer(12), 25. new String("foo"), 26. new Integer(5), 27. new Boolean(true) 28. }; 29. Arrays.sort(myObjects); 30. for(int i=0; i