Computer Science, asked by kraghaver, 1 year ago

What is the output of the following program?

public class MysteryProgram { public static void main(String[] args) { int x = 3; doubleMe(x); System.out.println("x doubled is " + x); } public static void doubleMe(int x) { x = x * 2; } }

Answers

Answered by saurabh000345
0
x doubled is 3.
the variable x is passed as value and so, no changes made to it out of scope are visible in the original parameter.
Similar questions