Java Programing laungage

Core Java Tutorial

Introduction of Core Java

How To Install JDk and Set of Path

Syntax of java Program

Difference between Java and C/C++

Advantage and Disadvantage of Java

What is Java

Why Java is not Pure Object Oriented Language

Java has Following Features/Characteristics

Limitation of Java Language and Java Internet

Common Misconception about Java

Simple Program of Java

Integrated Development Environment in java

Compile and Run Java Program

Applet and Comments in Java

Tokens in Java

Keywords in Java

Identifier and Variables in Java


Data Type in Java

Assignments and Initialization in Java

Operators in Java

Rule of Precedence in Java

Operator on Integer and Separators in Java Programming

Java Control Flow of Statements

If and If-else Selection Statement

Nested If-else and If-else-If Selection Statement

switch case and conditional operator Selection Statement

for and while Loop

do..while and for each Loop

break and labeled break statement

continue and labeled continue statement

return Statement and exit() Method

Escape Sequence for Special Characters and Unicode Code

Constants and Block or Scope

Statement in Java

Conversions between Numeric Types in Java

Import Statement in Java

User Input in Java using Scanner Class

User Input in Java using Console Class

Array in Java

One Dimensional Array

Two Dimensional Array

Two Dimensional Array Program

Command Line Argument in Java

String args Types in Java

Uneven/Jagged array in java

Math Class Function and Constant

Math Class all Function used in a program

Enumerated Types in Java

Object Oriented Programming v/s Procedural Programming

Object Oriented Programming Concepts in Java

Introduction to Class,Object and Method in Java

Class Declaration in Java

Class & Objects in java

Encapsulation in Java

Modifiers/Visibility for a Class or Interrface or member of a Class

Polymorphism in Java

Runtime polymorphism (dynamic binding or method overriding)

What are different types of classes in java ?
Previous Home Next

Java possesses five different types of class constructs and it is good to know where to use each type. The various class types used in java are the following :

  1. Top Level Classes : A top level class is the one that is present on the top in the hierarchy of class design as without it one can not develop software at all. An example of top level class is given as,

    Java Tutorialsclass r4r // top level class
     public static void main(String args[])
         // some logic
  2. Static Inner Classes : Static member classes are the most common type of nested classes. A nested class is defined inside the body of an enclosing class and should only be present to assist the enclosing class.

    There is no boundation to the depth of nesting of classes but it is quite very rare to see more than one level of such classes. Static member classes are also know as static inner classes.The syntax of static member classes is shown in following code snippet,


    Java Tutorialsclass InnerStaticClassExample 
    // main class
    public static void main(String args[])
    shape.Rectangle obj=new shape.Rectangle(4,7);             
    // creating object for inner class Rectangle, using dot notation
    //calculating the area of Rectangle
    System.out.println("The value of x is: "+t.a);                    
    //printing the variable defined in Rectangle Java Tutorialsircle(7).area();                                               
    //calculating the area of circle using the object of Rectangle
    System.out.println("The value of y is :" Java Tutorialsircle(7).y);  
    //printing the value of y
    Java Tutorialslass Shape                                                       
    	//top level class
    public static class Rectangle                                
    	//static-inner class, whose enclosing class is Shape
    int a=10;
    int length;
    int breadth;
    public Rectangle(int length, int breadth)                  
    	//constructor of Rectangle
    public void area()                                         
    	//this method calculates the area of rectangle
    System.out.println("The area of rectangle is :"+length*breadth);
    public class Java Tutorialsircle                                      
    // simple member class Circle, whose enclosing class is Rectangle which is static 
    int radius;
    int y=27;
    public Java Tutorialsircle(int radius)                             
    	//  constructor of Circle
    public void area()
    System.out.println("The area of circle is: "+Math.PI*radius*radius);
Previous Home Next

Tolal:0 Click:

Show All Comments

Did not find what you were looking for leave your name and message. We will revert within 24 hours
Comment / Feedback: