Created
July 7, 2022 15:22
-
-
Save vinimonteiro/ebaa411335141a0796d383bf4f322a11 to your computer and use it in GitHub Desktop.
Pass by value object ref no 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 = new Foo(5); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment