Difference between Class and object in Java
In Java, Class is a blue print used to create objects. In other words, a Class is a template that defines the methods (Functions) and Members (variables) to be included in a particular kind of Object.
Here, “Student” is a class. And “Jenna” is an object of the class “Student”. And “John” is another object of the class “Student”. A Class is a template for an object, a user-defined datatype that contains the variables and methods in it.
A class defines the abstract characteristics of a thing (object), including its characteristics (its attributes, fields or properties) and the thing’s behaviors (the things it can do, or methods, operations or features). That is, Class is a blue print used to create objects. In other words, each object is an instance of a class. One class can have multiple number of instances. (There can be Number of instances of the class “Student”, like “Jenna”, “John” etc).
A class is a predefined frame of an object, in which its mentioning what all variables and methods an object (object of that class) can have.
In Java, Class is a blue print used to create objects. In other words, a Class is a template that defines the methods (Functions) and Members (variables) to be included in a particular kind of Object.
Here, “Student” is a class. And “Jenna” is an object of the class “Student”. And “John” is another object of the class “Student”. A Class is a template for an object, a user-defined datatype that contains the variables and methods in it.
A class defines the abstract characteristics of a thing (object), including its characteristics (its attributes, fields or properties) and the thing’s behaviors (the things it can do, or methods, operations or features). That is, Class is a blue print used to create objects. In other words, each object is an instance of a class. One class can have multiple number of instances. (There can be Number of instances of the class “Student”, like “Jenna”, “John” etc).
A class is a predefined frame of an object, in which its mentioning what all variables and methods an object (object of that class) can have.

No comments:
Post a Comment