반응형
자격증/OCJP_ExamD2018. 7. 31. 00:22QUESTION 17

QUESTION 17 Given: import java.io.*; class Animal { Animal() { System.out.print("a"); } } class Dog extends Animal implements Serializable { Dog() { System.out.print("d"); } } public class Beagle extends Dog { } If an instance of class Beagle is created, then Serialized, then deSerialized, what is the result? A. ad B. ada C. add D. adad E. Compilation fails. F. An exception is thrown at runtime...

자격증/OCJP_ExamD2018. 7. 31. 00:18QUESTION 16

QUESTION 16 Given: 11. String test = "This is a test"; 12. String[] tokens = test.split("\s"); 13. System.out.println(tokens.length); What is the result? A. 0 B. 1 C. 4 D. Compilation fails. E. An exception is thrown at runtime. Solution : D Main.java:12: illegal escape character String[] tokens = test.split("\s"); ^ 1 error

자격증/OCJP_ExamD2018. 7. 30. 00:36QUESTION 15

QUESTION 15 Given that c is a reference to a valid java.io.Console object, and: 11. String pw = c.readPassword("%s", "pw: "); 12. System.out.println("got " + pw); 13. String name = c.readLine("%s", "name: "); 14. System.out.println(" got ", name); If the user types fido when prompted for a password, and then responds bob when prompted for a name, what is the result? A. pw: got fido name: bob got..

자격증/OCJP_ExamD2018. 7. 30. 00:28QUESTION 14

QUESTION 14 Given: 12. Date date = new Date(); 13. df.setLocale(Locale.ITALY); 14. String s = df.format(date); The variable df is an object of type DateFormat that has been initialized in line 11. What is the result if this code is run on December 14, 2000? A. The value of s is 14-dic-2000. B. The value of s is Dec 14, 2000. C. An exception is thrown at runtime. D. Compilation fails because of a..

자격증/OCJP_ExamD2018. 7. 30. 00:14QUESTION 13

QUESTION 13 Given: public class Yikes { public static void go(Long n) { System.out.print("Long "); } public static void go(Short n) { System.out.print("Short "); } public static void go(int n) { System.out.print("int "); } public static void main(String[] args) { short y = 6; long z = 7; go(y); go(z); } } What is the result? A. int Long B. Short Long C. Compilation fails.D. An exception is throw..

자격증/OCJP_ExamD2018. 7. 30. 00:08QUESTION 12

QUESTION 12 Given: 1. public class TestSeven extends Thread { 2. private static int x; 3. public synchronized void doThings() { 4. int current = x; 5. current++; 6. x = current; 7. } 8. public void run() { 9. doThings(); 10. } 11. } Which statement is true? A. Compilation fails. B. An exception is thrown at runtime. C. Synchronizing the run() method would make the class thread-safe. D. The data ..

반응형
image