05 October 2010

0 What is a Class in Java?

A Class is a blue print used to create objects.
A Class is a software template that defines the methods and variables to be included in a particular kind of Object.
Examples - Automobiles, Bank Account, Customer

A class contains state and behavior.

State (Variables)
State is the variables defined inside the class.
State (Member Variables) will not be exposed to external world.

Behavior (Methods)
Behavior of a class is the methods (Functions) defined inside the class.
Behavior is exhibited by the class to external world.
Behavior of a class will be exposed to external world (Exposure can be controlled by access specifiers like private, protected, public etc).

An object is an instance of a class.


0 comments:

Feeds Comments

Please give your valuable comments.