Hi Friend,
Class -
It explain the nature of a particular thing.
In OOPs Structure and modularity is provided by a Class .
Characteristics of the class should be used simply.
It acts like a blue print.
It is the central point of OOP and that contains data and codes with behavior.
In Java everything happens within class and it describes a set of objects with common behavior.
The class definition describes all the properties, behavior, and identity of objects present within that class.
As far as types of classes are concerned, there are predefined classes in languages like C++ and Pascal.
But in Java one can define his/her own types with data and code.
Object -
In OOPs Every class and an object have an instance.
Instance of a particular object is created at runtime.
Values defined for a particular object define its State.
Instance of an object explains the relation ship between different elements.
Objects are the basic unit of object orientation with behavior, identity.
These are part of a class but are not the same.
An object is expressed by the variable and methods within the objects.
Again these variables and methods are distinguished from each other as instant variables,
instant methods and class variable and class methods.
For e.g
class HelloWorld {
public static void main(String[] args){
HelloWorld helloObject = new HelloWorld();
helloObject.helloWorld();
}
public void helloWorld()
{
System.out.println("Hello World!");
}
}
Print the Output "Hello World".
Create a class "HelloWorld" having two method "main" and "helloWorld".
In main method create an object "helloObject" of "HelloWorld" and call the method helloObject.helloWorld()
For read in details :
http://www.roseindia.net/java/beginners/Thanks