Java

[JAVA] instanceof

torimuk 2022. 1. 12. 15:24

Problem


 

java의 instanceof 연산자

Solution


 

object instanceof type

의 경우, ojbect 가 type 이거나 type을 상속받는 클래스라면 true를 return, 아니면 false를 리턴.

 

code:

ArrayList al = new ArrayList();

System.out.println(al instanceof Object);

output:

true

URL


 

'Java' 카테고리의 다른 글

[Java-Gradle] error: unmappable character for encoding MS949  (0) 2022.01.07