Programming

(Java) how can I get the type of the object ?

steloflute 2013. 2. 24. 01:13

http://www.coderanch.com/t/404450/java/java/type-object


public void myMethod(Object obj) {  

    Class cls = obj.getClass();  

    System.out.println("The type of the object is: " + cls.getName());  





'Programming' 카테고리의 다른 글

(Java) [번역]자바 Enum의 10가지 예제  (0) 2013.02.24
Java for C Users (3): isDigit  (0) 2013.02.24
.gitignore for Java  (0) 2013.02.24
What's new in Java 1.7?  (0) 2013.02.24
A micro-manual for LISP Implemented in C  (0) 2013.02.19