

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