Oracle
1Z0-851 · Question #127
1Z0-851 Question #127: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-851 to reveal the answer and full explanation for question #127. The question stem and answer options stay visible for context.
Question
Given: 05. class Building { } 06. public class Barn extends Building { 07. public static void main(String[] args) { 08. Building build1 = new Building(); 09. Barn barn1 = new Barn(); 10. Barn barn2 = (Barn) build1; 11. Object obj1 = (Object) build1; 12. String str1 = (String) build1; 13. Building build2 = (Building) barn1; 14. } 15. } Which is true?
Options
- AIf line 10 is removed, the compilation succeeds.
- BIf line 11 is removed, the compilation succeeds.
- CIf line 12 is removed, the compilation succeeds.
- DIf line 13 is removed, the compilation succeeds.
- EMore than one line must be removed for compilation to succeed.
Unlock 1Z0-851 to see the answer
You've previewed enough free 1Z0-851 questions. Unlock 1Z0-851 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.