Question: Which statements about the clone() method are correct? (Choose two.) A. Calling clone() on a class that does not implement Cloneable results in a compiler
Which statements about the clone() method are correct? (Choose two.)
A. Calling clone() on a class that does not implement Cloneable results in a compiler error.
B. Calling clone() on a class that does not implement Cloneable results in an exception at runtime.
C. If a class implements Cloneable and does not override the clone() method, then the code does not compile.
D. If a class implements Cloneable and does not override the clone() method, then an exception is thrown at runtime.
E. Overriding the clone() method in a class that implements Cloneable guarantees at least a shallow copy will be performed.
F. Overriding the clone() method in a class that implements Cloneable may result in a deep copy.
Step by Step Solution
3.46 Rating (156 Votes )
There are 3 Steps involved in it
The correct options are B and E B Calling clone on a class that does not implement Cloneable results ... View full answer
Get step-by-step solutions from verified subject matter experts
