instanceof 操作符
X instanceof A:检验 x 是否为A类的对象
public class Main{
public static void main (string args[]){
Person person =new person
Student student =new student();
system.out .println(student instanceof person);
}
casting
对java对象的强制转换称为造型
object
是所有JAVA类的根类
instanceof 操作符
最新推荐文章于 2022-09-06 20:09:31 发布