-
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;
}
void print()
{
System.out.println(+ q);
}
}
public class access_specifier_result
{
public static void main(String args[])
{
access_Example obj = new access_Example();
obj.calc(5, 7);
System.out.println(obj.p);
obj.print();
}
}
-
- 6
7 - 8
9 - 10
11 - 5
6 - 4
6
- 6
Correct Option: A
Output:
6
7