13
是否有可能在java中获得与instanceof相反的结果?我试过这样的代码:instanceof的相反
if(example !instanceof blarg)....
但它不会让我把!任何地方没有错误,请帮助。
是否有可能在java中获得与instanceof相反的结果?我试过这样的代码:instanceof的相反
if(example !instanceof blarg)....
但它不会让我把!任何地方没有错误,请帮助。
你要否定整个事情:
if(!(example instanceof blarg))
作为替代化妆用isInstance
方法:
if (!example.class.isInstance(blarg))
{
// your code here
}
相关:http://stackoverflow.com/questions/9068150/best-办法对否定-A-的instanceof –