70 likes | 154 Views
Polymorphism. Page 206-221. Page 206. Objects Every class in Java extends class Object Every class you write extends Obje c t Any class that doesn’t explicitly extend another class, implicitly extends Object Page 208 – ArrayList methods -. Page 209. Class Object – 4 Methods
E N D
Polymorphism Page 206-221
Page 206 • Objects • Every class in Java extends class Object • Every class you write extends Object • Any class that doesn’t explicitly extend another class, implicitly extends Object • Page 208 – ArrayList methods -
Page 209 • Class Object – 4 Methods • Boolean equals () • Tells you if two objects are considered equal • Class getClass() • Gives you back the class an object is instantiated from • InthashCode () • Prints out a hashcode for the object • String toString () • Prints out a string message with name of class & a number
Q & A page 210; Example Page 211 • Read through Q&A – page 210 • Examples of using Polymorphic References of type object – • Good example of Array List Dog Objects v. Any type of objects! • Be Careful!!