Sun的tutorial里面说的,可以用来测试一个对象是不是一个特指class的实例,或者一个特指的subclass的实例,甚至是一个实现特指interface的class的实例.
The Type Comparison Operator instanceof
The instanceof operator compares an object to a specified type. You can use it to test if an object is an instance of a class, an instance of a subclass, or an instance of a class that implements a particular interface.
intanceof的用法
最新推荐文章于 2024-01-25 13:42:06 发布