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