QUESTION 49자격증/OCJP_ExamA2018. 7. 8. 19:14
Table of Contents
반응형
QUESTION 49
Given:
1. public class Pass {
2. public static void main(String [] args) {
3. int x = 5;
4. Pass p = new Pass();
5. p.doStuff(x);
6. System.out.print(" main x = " + x);
7. }
8.
9. void doStuff(int x) {
10. System.out.print(" doStuff x = " + x++);
11. }
12. }
What is the result?
A. Compilation fails.
B. An exception is thrown at runtime.
C. doStuff x = 6 main x = 6
D. doStuff x = 5 main x = 5
E. doStuff x = 5 main x = 6
F. doStuff x = 6 main x = 5
Solution : D
초기 x 값 5 --> doStuff x = 5 출력 --> main 문으로 다시 돌아와서 main x = 5
반응형
'자격증 > OCJP_ExamA' 카테고리의 다른 글
QUESTION 51 (0) | 2018.07.08 |
---|---|
QUESTION 50 (0) | 2018.07.08 |
QUESTION 48 (0) | 2018.07.08 |
QUESTION 47 (0) | 2018.07.08 |
QUESTION 46 (0) | 2018.07.08 |
@IT grow. :: IT grow.
#IT #먹방 #전자기기 #일상
#개발 #일상