Created
July 7, 2022 15:20
-
-
Save vinimonteiro/54fe657bb9bce3704bcb86db5aba61fe to your computer and use it in GitHub Desktop.
Pass by value object ref change original
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.vinimo; | |
public class App { | |
public static void main(String[] args) { | |
Foo foo = new Foo(1); | |
modify(foo); | |
System.out.println(foo.x); | |
} | |
public static void modify(Foo foo) { | |
foo.x=5; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment