반응형
자격증/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 ..

자격증/OCJP_ExamD2018. 7. 30. 00:00QUESTION 11

QUESTION 11 Given that Triangle implements Runnable, and: 31. void go() throws Exception { 32. Thread t = new Thread(new Triangle()); 33. t.start(); 34. for(int x = 1; x

자격증/OCJP_ExamD2018. 7. 29. 16:41QUESTION 10

QUESTION 10 Given: public class NamedCounter { private final String name; private int count; public NamedCounter(String name) { this.name = name; } public String getName() { return name; } public void increment() { count++; } public int getCount() { return count; } public void reset() { count = 0; } } Which three changes should be made to adapt this class to be used safely by multiple threads? (..

자격증/OCJP_ExamD2018. 7. 29. 16:23QUESTION 9

QUESTION 9 Given: 1. public class Threads3 implements Runnable { 2. public void run() { 3. System.out.print("running"); 4. } 5. public static void main(String[] args) { 6. Thread t = new Thread(new Threads3()); 7. t.run(); 8. t.run(); 9. t.start(); 10. } 11. } What is the result? A. Compilation fails. B. An exception is thrown at runtime. C. The code executes and prints running. D. The code exec..

반응형
image