CS2_20_ReferencesEquals

CS2_20_ReferencesEquals - CS2 Module 20 Category: OO...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
CS2 Module 20 Category: OO Concepts Topic: References, Equals/== Objectives Thorough treatment of references
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CS 2 Introduction to Object Oriented Programming Module 20 OO Concepts References - Equals/==
Background image of page 2
References
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
References Revisited What happens physically in memory when we say: int myInt; double myDouble; float myFloat; ???
Background image of page 4
We create variables myInt myDouble myFloat Variable is a symbol plus a value 1. Name is stored and 2. associated with a chunk of memory of the appropriate size.
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Assume that we have class Box class LLNode as well as the usual suspects: class String, Arrays etc.
Background image of page 6
What happens when we say Box theBox; LLNode head; String name; int [] lotsOfIntegers;
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
We create variables b head s A reference variable holds the location of an object. If it isn’t associated with an object yet, what value does the reference have? A reference variable holds the location of an object. If it isn’t associated with an object yet, what value does the reference have? Java keeps track of what type of object each reference can "point" to. Java keeps track of what type of object each reference can "point" to. Box LLNode String
Background image of page 8
Point p = new Point(1, 2); . .
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 32

CS2_20_ReferencesEquals - CS2 Module 20 Category: OO...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online