Vous ne pouvez pas sélectionner plus de 25 sujets
Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
123456789101112131415 |
- public class RecordPatternsPreview1OK {
- static void printGenericBoxString1(Box<Object> objectBox) {
- if (objectBox instanceof Box<Object>(String s)) {
- System.out.println(s);
- }
- }
-
- static void printGenericBoxString2(Box<String> stringBox) {
- if (stringBox instanceof Box<String>(var s)) {
- System.out.println(s);
- }
- }
- }
-
- record Box<T>(T t) {}
|