CMSC 132 Lecture Notes - Lecture 9: Cloning, Control Flow
Document Summary
No food or drinks are allowed in the ta room. Please do not rearrange the furniture. Please be considerate of fellow students who need help. once you have spoken with your ta please clear out to allow other students the same opportunity. When overriding a method in java, you can define the return type to be a subtype of the. We can create a copy of an object using the clone() method. The object class provides a clone() method that provides shallow copying. Clonenotsupportedexception - thrown to indicate that the clone method in class object. Notice the object class clone() method is defined as protected. All interactions with objects occur through reference variables. If no reference to object exists, object becomes garbage (useless, no longer affects program) Only needed if running low on memory. Contains action performed when object is freed. Not invoked if garbage collection does not occur. Share code between multiple constructors for same class.