저는이 질문에 호기심을 나타내고 있습니다. 어쩌면 의미가 없을 수도 있습니다.클래스 이름이 Java instanceof 인 경우
우리는 같은 자바 instanceof를 사용하고 있습니다 : 우리는 아래와 같이 사용할 수없는 이유
if (a instanceof Parent){ //"Parent" here is a parent class of "a"
}
:
if (a instanceof Parent.class){
}
두 번째의 관점에서 더 많은 의미를 'instanceof를'합니까 엄격한 프로그래밍? "Parent"와 "Parent.class"의 차이점은 무엇입니까?
관련 http://stackoverflow.com/questions/496928/what-is-the-difference-between-instanceof-and-class-isassignablefrom –
관련 http://stackoverflow.com/questions/2590640/why-cant -a-class-be-passed-to-instanceof – PeterMmm
주 : 두 번째 접근법의 경우 'Parent.class.isInstance (a)'가 적절한 검사입니다. – Vulcan