Object is a unique entity, which contains data and functions (characteristics and behaviour) together in an object oriented programming (oop) Language.They are the basic elements of Object Oriented system and they are also known as the entities of the OOP. The set of related objects may exchange data and information. They may interact with each other.
Any object in the real world can possess the following characteristics:
1. It is visible.
2. It can be defined and described easily.
3. It can be put into thought and action.
You can observe that any thing fulfilling above-mentioned criteria has unique identity,
definite shape (State) or characteristics and behaviours. For example consider an object
It has the following characteristics:
1 It has four legs.
2 It has a plain top.
It has the following behaviours:
1. It is used to keep glasses etc.
2. It is used to keep books etc.
For example, we can consider potato as an object, which possesses some characteristics and behaviours.
The characteristics could be explained as:
l. It is brown in colour.
2. It is special/oval in shape.
The behaviours could be explained as:
1. It is used to make vegetables.
2 .It is used to make chips.
Instance of a class
An object of the class is called instance of the class. In any language, where each object is created from a class, an object is called an instance of the class. Each object the same class would have the same data type defined with the class name.
Creating object of the class:
An object is creating from the class. The new keyword is used to create the object of a class in Java. New keyword allocating dynamic memory of an object. There are three steps to create an object from class.
- Declaration: It is uses class as data type along with an object.
- Instantiation: The new keyword is used for allocating an object in the memory.
- Initialization: It is used for calling a constructor to initialize attributes of the object.
Abc a1 = new Abc( );
Class object new
Static and Dynamic Bindinding in Java
Binding: Connecting a method call to the method body is known as binding.There are two types ...read more
Polymorphism in Java
Polymorphism in java is a concept by which we can perform a single action by ...read more
Encapsulation in Java
Encapsulation is grouping of the properties and methods within a class. Providing access to an object ...read more
Abstraction in Java
Abstraction is a process to hiding the implementation details and only showing the functionality to ...read more
What is OOPs?
Object Oriented Programming (OOP) OOPs is an approach to standardize the programs by creating partitioned memory ...read more
Features and Advantages of OOps
Feature of OOPs It makes the complete program simpler by dividing it into a number of ...read more