[JAVA] instanseof : Object 의 타입알기
2019. 10. 13. 18:42ㆍEXPERIENCE/WEB | Java&Spring Framework
반응형
If you just want to know if an object is an instance of or extends a certain class, or implements a certain interface, you can use the instanceof keyword.
public void myMethod(Object obj) {
if (obj instanceof String) {
System.out.println("It's a String");
}
else {
System.out.println("It's not a String");
}
}
https://coderanch.com/t/404450/java/type-object
반응형
'EXPERIENCE > WEB | Java&Spring Framework' 카테고리의 다른 글
[JS] Lodash? (0) | 2022.11.14 |
---|---|
[JAVA]java.net.UnknownHostException: Unable to resolve host : No address associated with hostname (0) | 2016.08.20 |
JAVA8 | lamda (0) | 2016.08.18 |
spring + mybatis + ppas error message 2 (0) | 2015.07.14 |
spring + mybatis + ppas error message 1 (0) | 2015.07.14 |