Classes embody all the features of a particular set of objects. In most cases, Java classes of objects are defined rather than actual objects. An instance of a class is another word for an actual object. Methods are functions defined inside classes that operate on instances of those classes. Fields consists of instance variables.
Instance variables define the attributes of an object.
The class define the type of the attribute, and each instance stores its own value for that attribute. An interface is a collection of abstract behaviour specification that individual classes can then implement. A package is a collection of classes and interfaces. Public is used to make a class, or a method in a class, or a variable in a class visible to all other classes in a Java program. This is used to exit a loop.