Want create site? Find Free WordPress Themes and plugins.

Object Oriented Programming (OOP) is a programming model where programs are organized around objects and data rather than action and logic. OOP allows decomposition of a problem into a number of entities called objects and then builds data and functions around these objects. Using the blueprint analogy, a class is a blueprint, and an object is a building made from that blueprint.

Class And Object In Java

Let define a class: A class is the core of any modern Object Oriented Programming language such as Java. In OOP languages it is mandatory to create a class for representing data. A class is a blueprint of an object that contains variables for storing data and functions to perform operations on the data. A class will not occupy any memory space and hence it is only a logical representation of data. 

Let define an object: Objects are the basic run-time entities of an object oriented system. They may represent a person, a place or any item that the program must handle. The software is divided into a number of small units which is an instance of a class called objects. An object is a software bundle of related variable and methods. The data of the objects can be accessed only by the functions associated with that object.

Difference between object and class:

1)Object is an instance of a class.Class is a blueprint or templatefrom which objects are created.
2)Object is a real world entity such as pen, laptop, mobile, bed, keyboard, mouse, chair etc.Class is a group of similar objects.
3)Object is a physical entity.Class is a logical entity.
4)Object is created through new keyword mainly e.g.Class is declared using class keyword e.g.
Student s1=new Student();class Student{}
5)Object is created many times as per requirement.Class is declared once.
6)Object allocates memory when it is created.Class doesn’t allocated memory when it is created.
7)There are many ways to create object in java such as new keyword, newInstance() method, clone() method, factory method and deserialization.There is only one way to define class in java using class keyword.
Did you find apk for android? You can find new Free Android Games and apps.

Leave a Comment