An inner class called InnerHello in a class called Hello: - Java Object Oriented Design

Java examples for Object Oriented Design:Inner Class

Description

An inner class called InnerHello in a class called Hello:

Demo Code

public class Hello { 

        class InnerHello { 
            InnerHello () { /*www.j  a v  a2  s.  c  o  m*/
                System .out.println ( 
                    "The method call is coming from inside the class!" 
                ); 
            } 
        } 

        public Hello () { 
            // empty constructor 
        } 

        public static void main (String [] arguments) { 
            Hello program = new Hello (); 
            Hello.InnerHello inner = program .new InnerHello (); 
        } 
    }

Result


Related Tutorials