Friday, 2 August 2013

What is Class?

A class is a blueprint or prototype that defines the variables and the methods (functions) common to all objects of a certain kind.
What does Java Class consist of
The first piece is a class-header which consists of the keyword "class" and the name you give to the class. Names in programming languages are also known as identifiers.
The second piece is the body. It consists of a pair of open/close curly brackets and between this all things related with that class means their property and method will come here.
Here is a template for the source code of a class:
class (Name of the class)
{
(Here define member of class)
...
}
Access level of class
Java class has mainly two type of access level:
Default: class objects are accessible only inside the package.
Public: class objects are accessible in code in any package.

No comments:

Post a Comment