Presentation is loading. Please wait.

Presentation is loading. Please wait.

Java Software Solutions

Similar presentations


Presentation on theme: "Java Software Solutions"— Presentation transcript:

1 Java Software Solutions
Chapter 2 Objects and Primitive Data

2 Object-Oriented Programming
This course introduces the idea of developing software by defining objects: Objects with which we can interact via our programs. Objects which can interact with each other as our programs execute. Your programs will define software objects that model objects in the real world. Data that describes an instance of an object at a point in time will be stored in the computers memory during program execution. Methods will be written that will allow an object to change its state and the state of other objects by changing their stored data.

3 An Example Suppose we write a program that models the interaction between a driver and an automobile. Our program could create a driver object and an automobile object. The description of these objects could become quite complex, but just to keep things simple: Suppose the automobile object has a method named changeSpeed and an instance variable named speed that holds the current value of the automobile’s speed. The driver object could send the automobile object a message (asking the automobile to change its speed) by calling the changeSpeed method and passing to it a new value for speed. The changeSpeed method would store the new speed value in the automobile’s speed instance variable. The new value could then be used in another of the automobile’s methods, perhaps called computeLocation, to compute the automobile’s changing location.


Download ppt "Java Software Solutions"

Similar presentations


Ads by Google