What is an Object in Java
What is an object really ?
They are real world things around us. They share two characteristics: They all have state and behavior.
Dogs have state (name, color, breed, hungry) and behavior (barking, fetching, wagging
Bicycles also have state (current gear, current pedal cadence, current speed) and behavior (changing gear, changing pedal cadence, applying brakes).
Identifying the state and behavior for real-world objects is a great way to begin thinking in terms of object-oriented programming.
Study any two real world objects and note down their states and behaviors. What similarities and differences do they have ,?
Create diagrams like this on your notes book. Compare and contrast .
Learn more
Comments
Post a Comment