QUESTION 55자격증/OCJP_ExamB2018. 7. 13. 21:32
Table of Contents
반응형
QUESTION 55Given:1. public class Threads4 {2. public static void main (String[] args) {3. new Threads4().go();4. }5. public void go() {6. Runnable r = new Runnable() {7. public void run() {8. System.out.print("foo");9. }10. };11. Thread t = new Thread(r);12. t.start();13. t.start();14. }15. }What is the result?A. Compilation fails.B. An exception is thrown at runtime.C. The code executes normally and prints foo.D. The code executes normally, but nothing is printed.Solution : B
plus imformation
foo Exception in thread "main" java.lang.IllegalThreadStateException
at java.lang.Thread.start(Thread.java:638)
at Threads4.go(Main.java:13)
at Threads4.main(Main.java:3)
반응형
'자격증 > OCJP_ExamB' 카테고리의 다른 글
QUESTION 57 (0) | 2018.07.13 |
---|---|
QUESTION 56 (0) | 2018.07.13 |
QUESTION 54 (0) | 2018.07.13 |
QUESTION 53 (0) | 2018.07.13 |
QUESTION 52 (0) | 2018.07.13 |
@IT grow. :: IT grow.
#IT #먹방 #전자기기 #일상
#개발 #일상