Monday 11 January 2016

Java Tutorial : Java why to use nested classes


Click here to watch in Youtube :
https://www.youtube.com/watch?v=KQb3m_HhQ3g&list=UUhwKlOVR041tngjerWxVccw

Click the below Image to Enlarge
Java Tutorial : Java why to use nested classes
Java Tutorial : Java why to use nested classes
Java Tutorial : Java why to use nested classes
Java Tutorial : Java why to use nested classes
Java Tutorial : Java why to use nested classes
A.java
//OuterClass
public class A
{

    private int value = 10;

    //InnerClass
    class B
    {
        int c;

        public void innerDisplay()
        {
            System.out.println("value : " + value);
        }
    }

}
OuterClassTest.java
public class OuterClassTest
{

    public static void main(String[] args)
    {
        A a = new A();
        A.B b = a.new B();
        b.innerDisplay();
    }

}
Output
value : 10
Click the below link to download the code:
https://sites.google.com/site/javaee4321/java/NestedClassDemo-Why-App.zip?attredirects=0&d=1

Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/NestedClassDemo-Why-App

Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/d3069ae3fffccb0c6ba4336662b6a2619d880c61/BasicJava/NestedClassDemo-Why-App/?at=master
See also:
  • All JavaEE Viedos Playlist
  • All JavaEE Viedos
  • All JAVA EE Links
  • Servlets Tutorial
  • All Design Patterns Links
  • JDBC Tutorial
  • Java Collection Framework Tutorial
  • JAVA Tutorial
  • No comments:

    Post a Comment