20090925-ClassDefinitions

20090925-ClassDefinitions - CSE115: Introduction to...

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
Announcements No classes on Monday before 6:00 PM No office hours on Monday New lab starting next week Exam grading should be finished tonight
Background image of page 2
What is a class definition ? A class definition is a description of the properties and behaviors that instances of the class will have. Recall that we said a running OO program is a system of interacting objects. Possible relationships between objects are determined by relationships between classes. (Important – we’ll return to this!)
Background image of page 3

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

View Full DocumentRight Arrow Icon
Where do objects come from? Objects are instances of classes We instantiate classes: e.g. new example1.Terrarium() There are three parts to this expression: new example1.Terrarium ()
Background image of page 4
„new‟ is a “reserved word” in Java. This means that the word „new‟ has a special meaning in the Java language. „new‟ is the name of an operator whose job it is to create an instance of a given class example1.Terrarium is the name of the class we are instantiating. It is a compound name, consisting of a package name (example1 ) and the name of the class‟ constructor (Terrarium), separated by a dot „.‟ A constructor initializes the state of a newly created object. The parentheses delimit the argument list of the constructor call. In this case there are no arguments being passed along to the constructor, so the argument list is empty. example1.Terrarium() is a constructor call . A constructor initializes the state
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.

This note was uploaded on 02/13/2011 for the course CSE 115 taught by Professor Decker during the Fall '08 term at SUNY Buffalo.

Page1 / 39

20090925-ClassDefinitions - CSE115: Introduction to...

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