In the olden days, not only did we have to walk a mile in the chilling winds of a snowstorm to get to school (hey our grandparents had it rougher; they had to do it to get to day care), we also had to make programs without buttons and scrollbars. Now, of course, we have object-oriented programming. This article will introduce you to the most important concepts as they relate to Java.
While an object represents one specific thing, a class represents a category of things. For example, a Ford dealership has many cars, all similar in make and model. If you were to go to one, you would notice they all have the same basic structure. Four tires, a couple of doors, a horn that unfortunately does not sound like the one in the Dukes of Hazard. You would say all of these Fords are in the same class.
But suppose you took one home. Maybe you added a DVD player to it, or a set of rims so high you could run over people without actually hitting them. Maybe you give this movie-playing monster truck a name. Herbert, why not? You no longer refer to it as a Ford, or its class, but instead as an individual object.
Class allows for uniformity within a program. All objects within a certain class, typically, should carry the same core properties. You wouldn't want to use a program where every button was a different color and size and behaved in an entirely new and wonderful way.
Unless you were Willy Wonka, in which case, you'd be better off sticking to chocolate.
In the above example we used Ford as a class of cars, and Herbert the Monster Truck as a special instance of a Ford, or an object. In addition to these two specifications, there is also a superclass. In the case of Ford, the superclass would be Cars and Trucks.
With inheritance, the subclass literally inherits certain qualities of the superclass. For instance, all Cars and Trucks drive on roads, have four tires, an engine, lights, etc. So therefore, all Fords inherit those same characteristics. That isn't to say that Fords can't have any different features; they can and do. But at the core, they are the same.
In programming this is done so that the programmer does not have to continually program objects and classes over and over. Instead, he can simply code it once and know that every time he creates an object, he will not have to worry about its core properties.
While an object is the abstract representation of everyday objects, the interface is its physical representation. This could be the buttons in a program, scrollbars, drop-down menus, etc. Simply put, the interface is the method by which you change the state and initiate the behavior of an object.
A good example would be the key to your car. You insert it into the ignition, which changes the state (sends electricity to the starter) and initiates the behavior change (starts the car).