因此,我使用IntelliJ IDEA在Java中进行编程,并且我尝试使用该关键字,instanceof并且我的代码最终看起来像这样:
public class Main {
public static void main(String args[])
{
One one = new One();
One two = new Two();
if (one instanceof Two)
{
System.out.println(one);
}
if (two instanceof Two)
{
System.out.println(one);
}
}
}
class One { }
class Two extends One { }
IntelliJtwo instanceof Two在行中给我一个提示“ [...]始终为真”,但是对于one instanceof TwoIntelliJ,我没有给我一个“ [...始终为假”的提示。有人知道为什么吗?
大话西游666
相关分类