Chapter 6 - Chapter6 WaysObjectsInteract( Methodcalls...

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

View Full Document Right Arrow Icon
    Chapter 6 Interacting Objects and Events
Background image of page 1

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

View Full DocumentRight Arrow Icon
    Ways Objects Interact (program communication) Method calls  tell an object to do something Function calls tell and object to do something and give you  some feedback
Background image of page 2
    More Program Communication Parameter passing give an object some information via a method  or function call Public instance variables and constants get or set public variables get public constants
Background image of page 3

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

View Full DocumentRight Arrow Icon
    One Detail You can’t talk to an object unless you  know its name! I.e. have a  reference  to it. Box foo =  This is an object of type “Box” reference object some other object
Background image of page 4
    The Null Pointer • It is possible to have a reference that doesn’t  point to an object yet. This is called a null  pointer. Box foo =  reference nothingness This is a null pointer. Don’t use it, or you’ll get in trouble! some object
Background image of page 5

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

View Full DocumentRight Arrow Icon
    “This” • Every object also has a reference to itself: this “this” is a Java keyword! It is a reference to the object in which  it’s used.
Background image of page 6
    Events An event is more or less anything…. that 
Background image of page 7

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

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

This note was uploaded on 01/28/2011 for the course CS 1131 taught by Professor Staff during the Fall '08 term at Michigan Technological University.

Page1 / 21

Chapter 6 - Chapter6 WaysObjectsInteract( Methodcalls...

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

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