Presentation is loading. Please wait.

Presentation is loading. Please wait.

Classes and Objects Still Chapter 1.

Similar presentations


Presentation on theme: "Classes and Objects Still Chapter 1."— Presentation transcript:

1 Classes and Objects Still Chapter 1

2 Defining a class Lets define a automobile class;
Lets look how to create a class in Greenfoot Why do we need to define the class? What do we need to define in a class?

3 Designing a Class Class Diagram Class Name
Data/characteristics/attributes Ask the question about the characteristics of the objects of this class? What can objects of this class do? How can we control objects of this class?

4 Class Car Class Car { // characteristics // operations/functions/methods }

5 How to instantiate an object?
Car mycar = new Car(); Car mycar = new Car(“Blue Car”);

6 How to invoke operations?
Car mycar = new Car(); mycar.setColor(“Blue”);

7 Lets construct this scenario on Greenfoot
A new world.. A new actor.. Etc.

8 Lets look at the Wombat world
Lets re-create Wombat class Can we reverse engineer the class diagram from the code?

9 10 things Class Object Method Data Class design Java Class structure
Object instantiation Create new World Create new Actor Naming conventions


Download ppt "Classes and Objects Still Chapter 1."

Similar presentations


Ads by Google