CodesJava

Easy learning with example program codes

What is class in java?


Class in Real world

Let us take the example of cars. There are thousands of cars in existence but all built from the same set of blueprints and therefore contains the same components. In other words your car is an instance (object) and cars is the blueprint (class of objects).

Class in programming

Class is act as a blue print or template for creating objects. It provides state and behavior for its objects. Java is a pure object oriented language means everything we discuss in java is an object.

Syntax:

access_modifier class class_name{ 
     //body of the class
}
Sign Up/ Sign In
Ask a Question


Copyright © 2018 CodesJava DMCA.com Protection Status SiteMap Reference: Java Wiki