What is a Class and Object?
In Java, a class doesn’t mean the same thing as the classes you take in school. A class is used to define a type (classify something). The class defines what objects of the class need to know (data or fields) and do (behaviors or methods). There are many classes that are part of the Java language. The most common ones are: (String, Math, System, List, ArrayList).
The real power of Java is being able to create your own classes (define your own types) as shown in the video below. Look at the video below for an example:
Classes create objects, and the objects do the actual work in an object-oriented program. You can think of a class like a cookie cutter. It’s used to create the cookies (objects) and can be used to create as many cookies (objects) as you want. A class can also be thought of as a factory that produces objects.
You can think of a class as the type or classification. The following picture has lots of cats (objects of the type cat).
To define a class in Java use the keywords public class followed by a ClassName. Then the body of the class is enclosed in a starting { and ending } as shown below.

A class in Java can have fields (data or properties), constructors (ways to initialize the fields), methods (behaviors), and a main method for testing the class. It does not have to have any of these items.

