Skip to main content

What is a class and an object in Java?

Entry Java
Quick Answer A class is a blueprint/template that defines fields (data) and methods (behavior). An object is an instance of a class - created with the new keyword. Example: class Car defines color, speed, and drive(). Each Car object is a separate instance with its own color and speed values but shares the same class methods.

Answer

Class: Blueprint for creating objects.
Object: Instance of a class containing data and behavior.
S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice