Java examples for Object Oriented Design:Inner Class
Increasing Class Encapsulation with Static Inner Class
public class Main { //from ww w. ja v a 2 s .c om static String hello = "Hello"; public static void sayHello(){ System.out.println(hello); } static class InnerExample { String goodBye = "Good Bye"; public void sayGoodBye(){ System.out.println(this.goodBye); } } public static void main (String[] args){ Main.sayHello(); Main.InnerExample inner = new Main.InnerExample(); inner.sayGoodBye(); } }