Fun with Recursion - Introduction (Example - 1)

PHOTO EMBED

Sun Feb 06 2022 20:12:45 GMT+0000 (Coordinated Universal Time)

Saved by @Uttam #java #gfg #geeksforgeeks #lecture #recursion #intro #methodcall #statementcall #methodinvoking

import java.io.*;
import java.util.*;

class GFG {

	
	static void fun1()
	{
		System.out.println("fun1");
	}

	static void fun2()
	{
		System.out.println("Before fun1");

		fun1();

		System.out.println("After fun1");
	}

	public static void main (String[] args) {
		
		System.out.println("Before fun2");

		fun2();

		System.out.println("After fun2");

	}
}
content_copyCOPY

Example 1: Understanding how the basic call of methods & statements works OUTPUT : ------------- Before fun2 Before fun1 fun1 After fun1 After fun2