

MCQOPTIONS
Saved Bookmarks
1. |
What is the output of this program?
class method { int p; int q; void add(int n) { p = n + 2; } void add(int n, int b) { p = n + 5; } } public class method_overloading { public static void main(String args[]) { method obj = new method(); int n = 0; obj.add(10); System.out.println(obj.p); } } |
A. | 10 |
B. | 11 |
C. | 12 |
D. | 13 |
E. | 14 |
Answer» C. 12 | |