[JAVA] instanseof : Object 의 타입알기
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 how can I get the type of the object ? (..
2019.10.13