Nested classes in java
// example on inner class in java
class OuterDemo
{
int num;
// inner class
private class InnerDemo
{
public void display()
{
System.out.println("inner class");
}
}
// access inner class from method within
void printInner()
{
InnerDemo objInner = new InnerDemo();
objInner.display();
}
}
public class InnerClassExample
{
public static void main(String[] args)
{
OuterDemo objOuter = new OuterDemo();
objOuter.printInner();
}
}