1.

What is the output of this program?

class method
{
int p;
int q;
void add(int n1)
{
p = n1 + 3;
}
void add(int n1 , int n2)
{
p = n1 + 5;
}
}
public class Method_overloading
{
public static void main(String args[])
{
method obj = new method();
int n1 = 0;
obj.add(10, 20);
System.out.println(obj.p);
}
}

A. 11
B. 12
C. 13
D. 14
E. 15
Answer» F.


Discussion

No Comment Found

Related MCQs