1Z0-808 practice question 29 of 30
Given the class definitions: class C1 {} class C2 extends C1 {} class C3 extends C2 {} and the code fragment: 16. C1 obj1 = (C1) new C2(); 17. C2…
Choose your answer, then check it against the explanation.
Given the class definitions:
class C1 {}
class C2 extends C1 {}
class C3 extends C2 {}
and the code fragment:
16. C1 obj1 = (C1) new C2();
17. C2 obj2 = (C2) new C3();
18. C2 obj3 = (C2) new C1();
19. C3 obj4 = (C3) obj2;
Which line throws ClassCastException?
Question 29 of 30
Keep practicing
Take the free 1Z0-808 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other 1Z0-808 practice questions
- Question 2Which three statements are true about the structure of a Java class? (Choose three.)
- Question 3Which three statements are true about exception handling? (Choose three.)
- Question 9Which two are benefits of polymorphism? (Choose two.)
- Question 15Which statement is true about the switch statement?
- Question 27Which statement is true about the switch statement?
- Question 28Which statement is true about the main() method?
