QUESTION 35
Which three code fragments, added individually at line 29, produce the output 100? (Choose three.)
10. class Inner {
11. private int x;
12. public void setX( int x ){ this.x = x; }
13. public int getX(){ return x;}
14. }
15.
16. class Outer {
17. private Inner y;
18. public void setY( Inner y ){ this.y = y; }
19. public Inner getY() { return y; }
20. }
21.
22. public class Gamma {
23. public static void main(String[] args) {
24. Outer o = new Outer();
25. Inner i = new Inner();
26. int n = 10;
27. i.setX(n);
28. o.setY(i);
29. // insert code here 29
30. System.out.println(o.getY().getX());
31.
32. }
33. }
A. n = 100;
B. i.setX( 100 );
C. o.getY().setX( 100 );
D. i = new Inner(); i.setX( 100 );
E. o.setY( i ); i = new Inner(); i.setX( 100 );
F. i = new Inner(); i.setX( 100 ); o.setY( i );
Solution : BCF
plus imformation
A. 10
B. 100
C. 100
D. 10
E. 10
F. 100
'자격증 > OCJP_ExamB' 카테고리의 다른 글
QUESTION 38 (0) | 2018.07.11 |
---|---|
QUESTION 36 (0) | 2018.07.10 |
QUESTION 34 (0) | 2018.07.10 |
QUESTION 32 (0) | 2018.07.10 |
QUESTION 31 (0) | 2018.07.10 |
#IT #먹방 #전자기기 #일상
#개발 #일상