The basic unit of Java programming is a class . There are no stand-alone programs, types, or variables. Everything is packaged inside some class. Normally each Java source file contains the definition of one publicly usable class, and the name of the public class is the same as the name of the file. A class is a collection of fields .
Variables hold data.
It is a stylistic convention of Java that class names are capitalized like proper names. The fields are then defined in a block enclosed by braces. Java classes cannot be nested inside anything else, and in Java everything is inside a class. Each method has a body delimited by braces containing all the executable statements of Java programming. Normally, method bodies would be much larger, making the size of the class definition larger.