QUESTION 9자격증/OCJP_ExamD2018. 7. 29. 16:23
Table of Contents
반응형
QUESTION 9Given: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 executes and prints runningrunning.E. The code executes and prints runningrunningrunning.Solution : E
plus imformation
class Threads 는 메서드 run을 가지고 있음 run은 running 을 출력함
Main문에서 class Threads에 대한 인스턴스를 하나 만듬 그게 t임
결국 threads의 run을 3번 실행 하는 꼴이 됨
반응형
'자격증 > OCJP_ExamD' 카테고리의 다른 글
QUESTION 11 (0) | 2018.07.30 |
---|---|
QUESTION 10 (0) | 2018.07.29 |
QUESTION 8 (0) | 2018.07.29 |
QUESTION 7 (0) | 2018.07.29 |
QUESTION 6 (0) | 2018.07.29 |
@IT grow. :: IT grow.
#IT #먹방 #전자기기 #일상
#개발 #일상