instanceof 操作符

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类的根类

猜你喜欢

转载自blog.csdn.net/weixin_45799690/article/details/103501186