My neighbor is taking "Intro to Java", and asked me to help explain a few of the first-day concepts. I realized that since I do this everyday, I don't have the beginner's mind, and it's hard to relate some of this stuff from scratch.
The one that's actually not trivial for me to explain is "what the heck is a class?"
Best I have so far:
A variable holds some kind of data; one variable might be a first name, another variable might be your weight in pounds.
A method is a function, it does stuff, and can do stuff with those variables. A method might display your name on screen, or tell you how much weight you should lose to have a good BMI ratio.
An object holds both variables and methods; one object might represent you, a second object might represent me.
A class is kind of the blueprint or template that describes the methods and variables that will be in each object. An object is an instantiated (instance of a) class; an object is something, while the class is simply the plans to make that something.
Continuing the example, we have a Person object, which is instantiated to hold Alice's data, and another Person object instantiated to hold Bob's data, and another for Carol, and so on.
How do I tune this example to make more sense, and/or what's a better approach? The word "instantiated" feels too heavy at this point.
(I think this is a useful question, but is obviously subjective; marked as community wiki.)
If your neighbor is into classical philosophy, classes are Plato's Forms and objects are the things we see everyday that are based on the Forms.
You might find this talk by Guy L. Steele interesting: http://video.google.com/videoplay?docid=-8860158196198824415#
class:: Man or Woman
object:: me, you ...
A java class is the structure or blueprint of an object and object is the instance(memory creation) of a class.
Example: Car is an object(real world entity). firstly, make the structure or design of a Car it's class and when the design of car, to convert real world Car it's an Object. the Car(object) is working now base behalf of design of a car(class).
Class: Girl
Object : that girl, this girl, my girl...umm maybe not.
Yea all girls should have the properties of a Girl (class in this case).
Class can be defined as the blue print or template which defines attributes,actions,states for the entity and Object would be the one which would be implementation for the entity.