“实例”的示例
2022-09-02 02:36:57
public class TableModel2 extends TableModel1 { ... }
TableModel2 tableModel = new TableModel2();
boolean t1 = tableModel instanceof TableModel1;
boolean t2 = tableModel instanceof TableModel2;
在上面的示例中,和 是 。那么,我该如何区分和使用?t1
t2
true
TableModel1
TableModel2
instanceof