Created
April 11, 2012 04:14
-
-
Save liweinan/2356814 to your computer and use it in GitHub Desktop.
获取Class的方法
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
/* 方法 1: 使用 .class */ | |
Class c = String[].class; | |
/* 方法 2: 使用实例的getClass()方法 */ | |
c = new String[1].getClass(); | |
/* 方法 3: 使用 Class.forName */ | |
c = Class.forName("[Ljava.lang.String;"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment