MCQOPTIONS
Saved Bookmarks
| 1. |
What is the output of this program?class method { int p; double q; void add(int n1 , int n2) { p = n1 + n2; } void add(double n3 , double n4) { q = n3 + n4; } method() { this.p = 0; this.q = 0; } } public class method_overload { public static void main(String args[]) { method obj = new method(); int n1 = 5; double n2 = 7.5; obj.add(n1, n1); obj.add(n2, n2); System.out.println(obj.p + " " + obj.q); } } |
| A. | 10 15.0 |
| B. | 10.0 15 |
| C. | 15 10 |
| D. | 10.0 15.0 |
| E. | None of these |
| Answer» B. 10.0 15 | |