Java Classes
Before we can create objects, we need to define a class. It acts as a blueprint for the object.
Think of a class as a blueprint of a house. It contains all the details about the floors, doors, windows etc. Based on these
descriptions we build the house. The actual physical house is the object.
In Java, we use the class keyword to Define a class.
For example,
Class ClassName {
}
If you have noticed, we have used the same structure in all of our previous examples.
A class can contain:
Fields – to store data
Methods – to perform tasks on fields