Sun Micro's tutorial
A class defined within another class is called a nested class. Like other members of a class, a nested class can be declared static or not. A non-static nested class is called an inner class. An instance of an inner class can exist only within an instance of its enclosing class and has access to its enclosing class's members even if they are declared private.

The following table shows the types of nested classes:

Types of Nested Classes
Type Scope Inner
static nested class member no
inner [non-static] class member yes
local class local yes
anonymous class only the point where it is defined yes

 

Inner Named class

 class Outer {
    Outer() {
        Inner i = new Inner();
        i.innerMethod();
    }
    // Inner class
    private class Inner {
        Inner() {}
        public void innerMethod() {
            // Do something.
        }
    }
}

import java.io.*;
import java.util.*;//to use EnumSet, EnumMap classes
//exmple of inner class
public class Test_This {
public static void main(String[] args) throws IOException{
Process pp = new Process();
try{
pp.read_line();
}//try
catch(NumberFormatException e)
{ System.out.println("data was blank");}
}
}

//class that will process request from main
class Process
{
public Process() { System.out.println("Process outer constructor");
}
public void read_line()
{
System.out.println("Reading Process outer class :");
Inner in = new Inner();
in.rea_inner();
}
               private class Inner //class inner
              {
              public Inner() { System.out.println("Process inner constructor");}
              private void rea_inner()
              {
              System.out.println("Process inner reader");

              }
}
}