package cn.classes;
public class OneClass
{
}
package cn.test;
import cn.classes.OneClass;
public class Test
{
public static void main(String[] args)
{
Class<?> c1 = null;
Class<?> c2 = null;
Class<?> c3 = null;
try
{
// 重要
c1 = Class.forName("cn.classes.OneClass");
}
catch (ClassNotFoundException e)
{
e.printStackTrace();
}
c2 = new OneClass().getClass();
c3 = OneClass.class;
// 结果cn.classes.OneClass
System.out.println(c1.getName());
System.out.println(c2.getName());
System.out.println(c3.getName());
}
}
java.lang;
java.lang.reflect