20090918-Variables

20090918-Variables - CSE115: Introduction to Computer...

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

View Full Document Right Arrow Icon
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall 645-4739 alphonce@buffalo.edu 1
Background image of page 1

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

View Full DocumentRight Arrow Icon
Agenda Announcements Cell phones off & name signs out Web-CAT: back up, lab 1 Next week – No new lab, but… hand in lab 1 and do exercises Wednesday: first exam Today variables terminology maybe class definitions
Background image of page 2
Last time we saw… how to instantiate a class to create an object new example1.Terrarium() how to call a method on a newly created object: new example1.Terrarium().add(new example1.Caterpillar())
Background image of page 3

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

View Full DocumentRight Arrow Icon
How do we make the Caterpillar move? • We call “start()” on the Caterpillar. How do we do this? Can we write the following? new example1.Terrarium().add(new example1.Caterpillar()) new example1.Caterpillar().start() • We can, but it won‟t do what we want. Q: what happens?
Background image of page 4
A: Two example1.Caterpillar objects are created. One is placed in the example1.Terrarium, and is NOT “started”. The other is NOT put into the example1.Terrarium, but is “started”. We cannot refer to the Caterpillar we added to
Background image of page 5

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

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

Page1 / 20

20090918-Variables - CSE115: Introduction to Computer...

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

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