CSC207H1 Lecture Notes - 2.-Class Torpedo Boat, Init, Texas State Highway Loop 1

34 views4 pages
11 Jan 2013
School
Course
Professor

Document Summary

Primitive aliasing not possible, only for objects: ex. ints are all primitive, not aliased. Int a = 19 points directly to 19red. A and b are not aliases, so changing a has no effect on b: new constructs an object not for primitives. S1 and s2 are aliases, so changing s1 affects s2. Strings are immutable: every change constructs a new string, slow method, change string variable to refer to new string b , nothing will refer to the old a anymore. Java keeps track of unused memory, slated for garbage collection. Equality: objects can be equivalent or be two of the same objects at the same location, . equals asks value equaity. All classes have an x. equals(y) method for comparing objects x & y, inherited from object class. When its inherited, just compares the memory location, ie. every class is chidern from the object class.

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

Related Questions