QUESTION 1자격증/OCJP_ExamD2018. 7. 26. 19:42
Table of Contents
반응형
QUESTION 1Given:1. public class KungFu {2. public static void main(String[] args) {3. Integer x = 400;4. Integer y = x;5. x++;6. StringBuilder sb1 = new StringBuilder("123");7. StringBuilder sb2 = sb1;8. sb1.append("5");9. System.out.println((x == y) + " " + (sb1 == sb2));10. }11. }What is the result?A. true trueB. false trueC. true falseD. false falseE. Compilation fails.F. An exception is thrown at runtime.Solution : B
plus imformation
x++ 이므로 y에 x값 대입후 x값은 +1 증가된 상태 --> false
Stringbuilder.append = 인스턴스에 append ( 문자열 ) 추가 --> True
반응형
'자격증 > OCJP_ExamD' 카테고리의 다른 글
QUESTION 6 (0) | 2018.07.29 |
---|---|
QUESTION 5 (0) | 2018.07.29 |
QUESTION 4 (0) | 2018.07.26 |
QUESTION 3 (0) | 2018.07.26 |
QUESTION 2 (0) | 2018.07.26 |
@IT grow. :: IT grow.
#IT #먹방 #전자기기 #일상
#개발 #일상