-
What is the output of this program?
class static_Access
{
static int p;
static int q;
void add(int n1, int n2)
{
p = n1 + n2;
q = p + n2;
}
}
public class static_output
{
public static void main(String args[])
{
static_Access obj1 = new static_Access();
static_Access obj2 = new static_Access();
int n1 = 5;
obj1.add(n1, n1 + 2);
obj2.add(6, n1);
System.out.println(obj1.p + " " + obj2.q);
}
}
-
- 11 16
- 16 11
- 17 11
- 11 17
- None of these
Correct Option: A
Output: 11 16