当前位置: 技术问答>java相关
一个关于 superclass的问题。
来源: 互联网 发布时间:2015-04-01
本文导语: When you pass objects around using references to their parent classes, sometimes you might want to know what you actually have. How to test the type of the object passed? | 判断对象是否为某个类的实例可用:xx...
When you pass objects around using references to their parent classes, sometimes you might want to know what you actually have. How to test the type of the object passed?
|
判断对象是否为某个类的实例可用:xxx instanceof Xxx
得到一个对象的类名可用:xxx.getClass().getName()
得到一个对象的类名可用:xxx.getClass().getName()
|
instancof
|
好象是OBJECT.instanceOf()