Created
September 20, 2012 01:54
-
-
Save itang/3753531 to your computer and use it in GitHub Desktop.
获取基本类型的包装类
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PrimitiveTypeTest { | |
public static void main(String[] args) { | |
System.out.println(getPrimitiveWrapperType(int.class)); | |
} | |
private static Class<?> getPrimitiveWrapperType(Class<?> class1) { | |
if (class1 == java.lang.Integer.TYPE) { // 不是 class1 == java.lang.Integer.class | |
return Integer.class; | |
} | |
return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment