📅  最后修改于: 2022-03-11 14:52:07.209000             🧑  作者: Mango
//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);
}