forked from eazybytes/java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMethodInvocationDemo.java
More file actions
34 lines (28 loc) · 843 Bytes
/
MethodInvocationDemo.java
File metadata and controls
34 lines (28 loc) · 843 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
public class MethodInvocationDemo {
public static void main(String[] args) {
MethodInvocationDemo demoObj = new MethodInvocationDemo();
demoObj.method1();
}
public void method1() {
int number = 10;
System.out.println("Method 1");
String output = method2();
System.out.println(output);
}
public String method2() {
String output = "Hello World";
System.out.println("Method 2");
method3("Hi");
return output;
}
public void method3(String input) {
System.out.println(input);
System.out.println("Method 3");
method4(10);
}
public void method4(int num) {
MethodInvocationDemo demoObj = new MethodInvocationDemo();
System.out.println(num);
System.out.println("Method 4");
}
}