20090925-ClassDefinitions

20090925-ClassDefinitions - Click to edit Master subtitle...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

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

Unformatted text preview: Click to edit Master subtitle style CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall 645-4739 alphonce@buffalo.edu 11 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  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 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 new is a reserved word in Java. This means that the word new has a special meaning in the Java language. n e w is th e n a m e o f a n o p e r a to r w h o s e jo b i t is t o c r e a te a n in s ta n c e o f a g iv e n c la s s e x a m p le 1 .T e r r a r iu m is th e n a m e o f t h e c la s s w e a r e in s ta n t ia t in g . I t is a c o m p o u n d n a m e , c o n s is t in g o f a p a c k a g e n a m e ( e x a m p le 1 ) a n d t h e n a m e o f t h e c la s s c o n s t r u c to r ( T e r r a r iu m ) , s e p a r a t e d b y a d o t . A c o n s t r u c to r in i t ia l iz e s th e s ta te o f a n e w ly c r e a te d o b je c t . T h e p a r e n t h e s e s d e l im i t th e a...
View Full Document

Page1 / 39

20090925-ClassDefinitions - Click to edit Master subtitle...

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