summaryrefslogtreecommitdiff
path: root/oop/09-pass-by-value-reference/PassByValue.java
blob: 2500d03fb76171910c726b6b48d1c899c8e4c23b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
public class PassByValue {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		int x = 4;
		System.out.println(x); // 4
		method(x, 2);
		System.out.println(x); // ?
	}

	public static void method(int x, int b) {
		x = x + 1;
		System.out.println(x); // 5
	}
}