

MCQOPTIONS
Saved Bookmarks
1. |
What is the output of this program?
class static_Access { static int p; static int q; void add(int n1, int n2) { p = n1 + n2; q = p + n2; } } public class static_output { public static void main(String args[]) { static_Access obj1 = new static_Access(); static_Access obj2 = new static_Access(); int n1 = 5; obj1.add(n1, n1 + 2); obj2.add(6, n1); System.out.println(obj1.p + " " + obj2.q); } } |
A. | 11 16 |
B. | 16 11 |
C. | 17 11 |
D. | 11 17 |
E. | None of these |
Answer» B. 16 11 | |