Java Pattern Pencocokan 16

//Before Pattern Matching
if (obj instanceof String) {
  String str = (String) obj;
  System.out.println(str);
}
 
//After Pattern Matching
if (obj instanceof String str) {
  System.out.println(str);
}
Cute Corncrake