CS 112 Final: CS 112 - Final Exam

128 views42 pages
15 Sep 2018
School
Course
Professor

Document Summary

Super, overload methods, final keyword, and final data 3. Super, overload methods, final keyword, and final data. If a parent class constructor with the specified signature doesn"t exist or is not accessible, a compile time error will result: parent class (if not java. lang. object) will call constructor of its parent class. Calling overload methods: use super to call an overridden method: supermethodnam(), super is similar to this super refers to the immediate parent"s environment while this refers to current environment; both for member variables and for methods. Instanceof to test if an object is a member of a given class or derived from that class. It will always return false if the object-reference is null. Equals(: equals is meant to compare the content of two instances of a class for equality. This often means comparing all of an object"s data members for equality, but it can be defined in other ways as well.