import java.util.Scanner; /** * This class contains the first method that we are writing. */ public class VoidMethod { /** * main simply will call our method */ public static void main(String[] args) { System.out.println("Hello World from main (before method call)"); for (int i=0;i<3;i++) sayHello(); System.out.println("In main, returned from method."); } /** * sayHello prints "Hello World" to the screen */ public static void sayHello() { System.out.println("Hello World from inside a method!"); Scanner sc=new scanner(System.in); boolean ans=sc.next(); if (ans) deeperMsg(); // this is a method call } /** * deeperMsg gets called from displayMsg */ public static void deeperMsg() { System.out.println("Hello World from inside a deeper method!"); } }