What is the difference between an Object and a Class in Java? | Java Tutorial Online

Posted by , , , , 3 Comments

Welcome to FreshersPlane, FreshersPlane Provide you latest Job Notifications , Career Opportunities, Government Jobs Information,

Don't forget to subscribe to email notifications to get all latest jobs directly to your email daily. We post more than 1000+ jobs every week.So,

Welcome back to Java Tutorial Online. This is one of the basic question of Java. In Java everything is an Object, but a Class is used to make it. The exact definition is that “A class is a blueprint for an object”. Particularly it tells the JVM about how to make the Object.

When I say that a class is a blueprint of an Object, I mean that every Object in Java made from that class is practically the same but can have its own specific values. Like whenever a building is made, then a blueprint is made beforehand. The blueprint defines the structure of the building, but using the same blueprint you may create many separate buildings. Each building can have its own color on the walls, its own particular size, etc. But the overall structure will be the same.

I will take one more example to clarify my point. We know that the process of making a car is totally automated. Now the cavity which molds the shape of the car is the same, but the same cavity is used to mold several cars. Like in the Mercedes factory, each Mercedes coming out from the car molding cavity will be practically the same. Though each Mercedes can later be given its particular color, alloy wheels, extra bumper, advanced music system, etc. Here the cavity which molds the car is the “class” in Java, and the Mercedes car coming out from that cavity is the “Object” in Java.

Find the Latest Jobs in our site for freshers , experience .List of walkings , fresher jobs, latest jobs,Govt Jobs, Sarkari Naukri for all engineering branches, all graduates, Apply for all jobs mentioned in our site.

Now you would be easily able to visualize the difference between a class and an Object in Java. I hope that this article was beneficial in helping you distinguish between an Object and a Class. If you liked the article then do leave a comment. I would love to hear from you. For more info on Java, keep buzzing http://freshersplane.net



Enter your email address:

Delivered by Apply Now