Vidyalelo
Java Programming · Q83

Miscellaneous Java

Programming · Java Programming · question 83

Q83

What will be the output of the following Java program? class access public int x; static int y; void cal(int a, int b) x += a ; y += b; class static_specifier public static void main(String args[]) access obj1 = new access(); access obj2 = new access(); obj1.x = 0; obj1.y = 0; obj1.cal(1, 2); obj2.x = 0; obj2.cal(2, 3); System.out.println(obj1.x + " " + obj2.y);

A.
1 2
B.
2 3
C.
3 2
D.
1 5
Answer

Answer: Option D

Solution

Answer: Option D
No explanation is given for this question Let's Discuss on Board