Virtual Classes Logo          Virtual Classes
    Read Anytime,Anywhere


Objects are the building blocks of Oop and are commonly defined as variables or data structures that encapsulate behavior and data in a programmed unit. An object can be considered a "thing" that can perform a set of related activities. The set of activities that the object performs defines the object's behavior. For example, the Hand (object) can grip something or a Student (object) can have name or address. an object is a self-contained component that contains properties and methods needed to make a certain type of data useful. An object’s properties are what it knows and its methods are what it can do.

In pure OOP terms an object is an instance of a class. Every object is composed by:
Object identity: Means that every object is unique and can be differentiated from other objects. Each time an object is created (instantiated) the object identity is defined.
Object behavior: What the object can do. In OOP, methods/functions defines the set of actions that the object can do.
Object state: The data stored within the object at any given moment. In OOP, fields, constants, and properties define the state of an object.

How to create object-
ClassName objectName=new ClassName();

Example- Here we are creating the object of Animal class.
Animal animal=new Animal();

Below images shows Two wheeler Class and it's object representation.

Class and Object example in OOP