-
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);
}
}
-
- 11
- 12
- 13
- 14
- 15
Correct Option: E
Output: 15