instanceof运算符
instanceof是二元随机运算符,左边是对象,右边是类;当对象是右面类或子类所创建对象时,返回true,否则返回false。
/**
* 练习instanceof运算符
* @author 叙黎
*
*/
public class test {
public static void main(String[] args) {
Student student=new Student();
System.out.println(student instanceof Student );
}
}
class Student {
}
结果为:true