Java examples for Object Oriented Design:Method Parameter
Understanding pass-by-value
public class ChangeParameters { public static void main(String[] args) {/*from ww w .j a va 2 s .co m*/ int number = 1; tryToChangeNumber(number); System.out.println(number); } public static void tryToChangeNumber(int i) { i = 2; } }