-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA2q2.java
More file actions
45 lines (37 loc) · 703 Bytes
/
Copy pathA2q2.java
File metadata and controls
45 lines (37 loc) · 703 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
import java.util.*;
class A2q2
{
int i=10;
static int j=15;
void funct1()
{
System.out.println("i= "+i);
System.out.println("j= "+j);
i++;
j++;
}
static void funct2()
{
int a=10;
//System.out.println("i= "+i); cannot be accessed as it is nonstatic member..........
System.out.println("j= "+j);
System.out.println("a= "+a);
System.out.println("a+j= "+(a+j));
}
/*int funct3()
{
return a+a; cannot use a here bcz it has local
} scope in funct2.....
static int funct4()
{
return a+a;
}*/
public static void main(String []args)
{
A2q2 ob=new A2q2();
ob.funct1();
ob.funct2();
//ob.funct3();
//ob.funct4();
}
}