5-4 DeepAndDeeper

posted Mar 29, 2014, 9:18 AM by Dlovan ismail
//This program demonstrates hierarchical method call.

package deepanddeeper;

public class DeepAndDeeper 
{
        public static void main(String[] args)
        {
            System.out.println("I am starting in main.");
            deep();
            System.out.println("Now I am back in main.");
        } 

        //The deep method displays a message and then calls the deeper method. 

        public static void deep()
        {
            System.out.println("I am now in deep.");
            deeper();
            System.out.println("Now I am back in deep.");
        }

        //The deeper method simply displays a message.

        public static void deeper()
        {
            System.out.println("I am now in deeper.");
        }
}

ċ
DeepAndDeeper.java
(1k)
Dlovan ismail,
Mar 29, 2014, 9:18 AM
Comments