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.
Ads by Google


What are members of Class?
When we create a class its totally incomplete without defining any member of this class same like we can understand one family is incomplete if they have no members.
Field : Field is nothing but the property of the class or object which we are going to create .for example if we are creating a class called computer then they have property like model, mem_size, hd_size, os_type etc
Method : Method is nothing but the operation that an object can perform it define the behavior of object how an object can interact with outside world .startMethod (), shutdownMethod (). Access Level of members: Access level is nothing but where we can use that members of the class.
Each field and method has an access level: private: accessible only in this class package or default: accessible only in this package protected: accessible only in this package and in all subclasses of this class public: accessible everywhere this class is available The general form of a class definition is shown here:
Simple Java Example

  1. /*
  2. Java Hello World example.
  3. */
  4.  
  5. public class HelloWorldExample{
  6.  
  7.   public static void main(String args[]){
  8.  
  9.     /*
  10.     Use System.out.println() to print on console.
  11.     */
  12.     System.out.println("Hello World !");
  13.  
  14.   }
  15.  
  16. }
  17.  
  18. /*
  19.  
  20. OUTPUT of the above given Java Hello World Example would be :
  21.  
  22. Hello World !
  23.  
  24. */

Previous - Install Java                                                                                 Next - Java Strings