summaryrefslogtreecommitdiff
path: root/oop/09-pass-by-value-reference/PassByValue.java
diff options
context:
space:
mode:
Diffstat (limited to 'oop/09-pass-by-value-reference/PassByValue.java')
-rw-r--r--oop/09-pass-by-value-reference/PassByValue.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/oop/09-pass-by-value-reference/PassByValue.java b/oop/09-pass-by-value-reference/PassByValue.java
new file mode 100644
index 0000000..2500d03
--- /dev/null
+++ b/oop/09-pass-by-value-reference/PassByValue.java
@@ -0,0 +1,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
+ }
+}