Created
January 22, 2022 15:40
-
-
Save TGITS/c855de19a7519ce4db7a71ddcb827789 to your computer and use it in GitHub Desktop.
Un premier exemple de record avec utilisation de la méthode toString et d'un accesseur
This file contains 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
//A exécuter sous JShell : /open RecordExampleScript_1.java | |
public record House(String name, String seat, String sigil, String familyWords) { | |
} | |
var house = new House("Stark", "Winterfell", "A Gray Direwolf", "Winter is coming"); | |
System.out.println(house); // Utilisation implicte de la méthode toString | |
System.out.println(house.seat()); // Utilisation d'un accesseur |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment