Computer Science, asked by rishikasrivastava28, 4 months ago

what is the difference between object and class​

Answers

Answered by shahbadrehan820
1

Answer:

The difference is simple and conceptual. A class is a template for objects. ... An object is a member or an "instance" of a class. An object has a state in which all of its properties have values that you either explicitly define or that are defined by default settings.

Answered by 4514prathikshapraba
1

Answer:

Object

1) Object is an instance of a class.

2) Object is a real world entity such as pen, laptop, mobile, bed, keyboard, mouse, chair etc.

3) Object is a physical entity.

4) Object is created through new keyword mainly e.g.

Student s1=new Student()

5) Object is created many times as per requirement

6) Object allocates 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

Class

1. Class is a blueprint or template from which objects are created.

2. Class is a group of similar objects.

3.Class is a logical entity

4. Class is declared using class keyword e.g.

class Student{}

5.Class is declared once

6. Class doesn't allocated memory when it is created

7. There is only one way to define class in java using class keyword

Similar questions