Review Questions |
6.17 |
Given the following program, which statement is true?
// Filename: MyClass.java public class MyClass { public static void main(String[] args) { A[] arrA; B[] arrB; arrA = new A[10]; arrB = new B[20]; arrA = arrB; // (1) arrB = (B[]) arrA; // (2) arrA = new A[10]; arrB = (B[]) arrA; // (3) } } class A {} class B extends A {} Select the one correct answer.
|
Get Programmer's Guide to Java™ Certification, A: A Comprehensive Primer, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.