Java Certification Exam Questions And CORRECT Answers
If you overwrite clone(), which 3 rules must this method obey?1) the new object should be new: memory address should differ 2) Both should be an object of the same class 3) Both should be in the same state: ().equals(a) == true Why do we need to implement the Clonable interface?At runtime it would throw the CloneNotSupportedException if we don't implement the Cloneable interface. A class implements the Cloneable interface to indicate to the O() method that it is legal for that method to make a field-for-field copy of instances of that class. What is a marker interface?A Marker interface, has no method. Serializable, Clonable are marker interfaces.
Written for
- Institution
- Java
- Course
- Java
Document information
- Uploaded on
- April 25, 2024
- Number of pages
- 36
- Written in
- 2023/2024
- Type
- Exam (elaborations)
- Contains
- Questions & answers
Subjects
Also available in package deal