QUESTION 3자격증/OCJP_ExamB2018. 7. 9. 00:13
Table of Contents
반응형
QUESTION 3
Given:
class ClassA {}
class ClassB extends ClassA {}
class ClassC extends ClassA {}
and:
ClassA p0 = new ClassA();
ClassB p1 = new ClassB();
ClassC p2 = new ClassC();
ClassA p3 = new ClassB();
ClassA p4 = new ClassC();
Which three are valid? (Choose three.)
A. p0 = p1;
B. p1 = p2;
C. p2 = p4;
D. p2 = (ClassC)p1;
E. p1 = (ClassB)p3;
F. p2 = (ClassC)p4;
Solution : AEF
plus imformation :
B.
incompatible types
found : ClassC
required: ClassB
p1 = p2;
^
C. incompatible types
found : ClassA
required: ClassC
p2 = p4;
^
D. inconvertible types
found : ClassB
required: ClassC
p2 = (ClassC)p1;
^
반응형
'자격증 > OCJP_ExamB' 카테고리의 다른 글
QUESTION 6 (0) | 2018.07.09 |
---|---|
QUESTION 5 (0) | 2018.07.09 |
QUESTION 4 (0) | 2018.07.09 |
QUESTION 2 (0) | 2018.07.08 |
QUESTION 1 (0) | 2018.07.08 |
@IT grow. :: IT grow.
#IT #먹방 #전자기기 #일상
#개발 #일상