-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasics.java
More file actions
45 lines (37 loc) · 949 Bytes
/
Copy pathbasics.java
File metadata and controls
45 lines (37 loc) · 949 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package Recursion;
public class basics {
public static void main(String[] args) {
// in recursion, we call the function inside another function .
// msg();
/*
msg2();
msg3();
msg4();
*/
// so instead of calling various the msg fn again n again why don't we just
// solution ???
// call one fn inside of another fn
// and now we just call single msg fn which will call all the remaining fns.
msg();
}
// ex:
static void msg(){
System.out.println("hello world!");
msg1();
}
static void msg1(){
System.out.println("hello world!");
msg2();
}
static void msg2(){
System.out.println("hello world!");
msg3();
}
static void msg3(){
System.out.println("hello world!");
msg4();
}
static void msg4(){
System.out.println("hello world!");
}
}