关于instanceof ,两边类型要有关系,通常左边必有钱类型范围大,右边集成左边的类型。
1
2
3
4
5
6
7
8 |
public class BasicTypeTest { public
static void main(String[] args) { Object test = 12 ; boolean
flag = test instanceof
Integer; // flag = instanceof Integer; //报错 System.out.println(flag); } } |
原文地址:http://www.cnblogs.com/baby-bear/p/3699809.html