Skip to content

Instantly share code, notes, and snippets.

@liweinan
Created April 11, 2012 04:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save liweinan/2356814 to your computer and use it in GitHub Desktop.
Save liweinan/2356814 to your computer and use it in GitHub Desktop.
获取Class的方法
/* 方法 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