BIG
DATA

JAVA

CLASS AND OBJECTS IN JAVA

Read more about »
  • Java 9 features
  • Read about Hadoop
  • Read about Storm
  • Read about Storm
 

Object

As the name object-oriented implies, objects are key to understanding object-oriented technology. Look around right now and you'll find many examples of real-world objects: your cat, your table, your LED TV, your bicycle, etc. Software objects are conceptually similar to real-world objects: they too consist of state and related behavior. An object stores its state in fields (variables in some programming languages) and exposes its behavior through methods (functions in some programming languages).

Class

In the real world, you often have many objects of the same kind. For example, your bicycle is just one of many bicycles in the world. Using object-oriented terminology, we say that your bicycle object is an instance of the class of objects known as bicycles. Bicycles have some state (current gear, current cadence, two wheels) and behavior (change gears, brake) in common. However, each bicycle's state is independent of and can be different from other bicycles.

NOTE:

Class and Objects are covered in more detail in OOP section.