05 October 2010
4 Difference between Class and object in Java?
Difference between Class and object in Java |
"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 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 blue print, in which its mentioning what all variables it (it means an object of that class) will have, what all methods it will have.
Subscribe to:
Post Comments (Atom)
4 comments:
I really like your short and concise tutorial about explaining a particular topic. keep it up.
Thanks
Javin
How HashMap works in Java
thanks for sharing your idea
Very good example... thanks
Thanks for providing nice example
Please give your valuable comments.