1.

What is the output of this program?

class access_Example
{
public int p;
private int q;
void calc(int n1, int n2)
{
p = n1 + 1;
q = n2;
}
}
public class access_specifier
{
public static void main(String args[])
{
access_Example obj = new access_Example();
obj.cal(5, 7);
System.out.println(obj.p + " " + obj.q);
}
}

A. 5 7
B. 7 7
C. Compiletime error
D. Runtime error
E. None of these
Answer» D. Runtime error


Discussion

No Comment Found

Related MCQs