CSE 8B Chapter Notes - Chapter 11.6-11.10: Downcasting, Type Signature, Subtyping

56 views2 pages

Document Summary

Every java class is descended from the java. lang. object class. Default super class is object tostring(: returns string representation of the object. Polymorphism: variable of a supertype can refer to a subtype object. Classes define types: superclass == supertype, subclass == subtype. An instance of a subclass is an instance of a superclass, not vice versa. Subclass object can be used whenever superclass object used. Methods can be implemented in several classes along inheritance chain. Type that de(cid:272)lares varia(cid:271)le is (cid:272)alled the varia(cid:271)le"s de(cid:272)lared type: type that is to the left of the variable name, decides which method to match @ compile time. Type that is the actual class for object referenced by variable is actual type: type that is to the right of the variable name, methods of the actual type are always invoked first dynamic binding. One object reference can be typecast into another object reference: called casting object.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents