Solved

Consider the Following Code Snippet: Public Class Box<E>

Question 14

Multiple Choice

Consider the following code snippet: public class Box<E>
{
Private E data;
Public Box() { . . . }
Public void insert(E value) { . . . }
Public E getData() { . . . }
}
What will result from executing the following code?
Box<Boolean> box = new Box<Boolean>() ;
Box b = (Box) box.getData() ;


A) compile-time error
B) run-time error
C) correct generic assignment
D) compile-time warning

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions