Combien d'objets sont crées?
Created
September 28, 2023 12:01
-
-
Save nherbaut/e9c49bc4597e4cb087ed48130475943d to your computer and use it in GitHub Desktop.
L2.2.4 Exo classes type et for
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
| public class Thing { | |
| private int a; | |
| public Thing(int x) { | |
| a = x; | |
| } | |
| public int geta() { | |
| return a; | |
| } | |
| public static void main(String ...args){ | |
| Thing f = new Thing(3); | |
| Thing g = new Thing(5); | |
| Thing h = f; | |
| Thing j = h; | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
execute me on https://java.miage.dev/?gistId=e9c49bc4597e4cb087ed48130475943d