-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmethonCall.java
More file actions
43 lines (35 loc) · 824 Bytes
/
methonCall.java
File metadata and controls
43 lines (35 loc) · 824 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
class Test
{
public static int i = 0;
Test()
{
i++;
}
public static int get()
{
return i;
}
public int m1()
{
System.out.println("Inside the method m1 by object of GFG class");
this.m2();
return 1;
}
public void m2()
{
System.out.println("In method m2 came from method m1");
}
}
class GFG
{
public static void main(String[] args)
{
Test obj = new Test();
int i = obj.m1();
System.out.println("Control returned after method m1 :" + i);
int no_of_objects = Test.get();
System.out.print("No of instances created till now : ");
System.out.println(no_of_objects);
}
}
// method calls are implemented through stack.8