/**
*
*/
package package3;
import javax.management.InstanceAlreadyExistsException;
/**
* @author Administrator
*
*/
public class ClassTest {
/**
* @param args
* @throws ClassNotFoundException
*/
@SuppressWarnings("rawtypes")
public static void main(String[] args) throws ClassNotFoundException,
InstanceAlreadyExistsException,
IllegalAccessException{
String s1 = "1234";
Class c1 = s1.getClass();
Class c2 = String.class;
Class c3 = Class.forName("java.long String");
//比较字节码是否相同
System.out.println("***************************");
System.out.println("c1和c2是否是同一个对象"+(c1==c2));
System.out.println("c1和c3是否是同一个对象"+(c1==c3));
System.out.println("***************************");
//检测是否是基本数据类型
System.out.println("Steing是否是基本数据类型"+String.class.isPrimitive());
System.out.println("int是否是基本数据类型"+int.class.isPrimitive());
//检测int和INTERGER是否只想同一个字节码
System.out.println("int和integr字节码是否相同"+(int.class==Integer.class));
System.out.println("int和Integer。type的字节码是否是同一个对象"+(int.class==Integer.TYPE));
//关于数组方面的字节码
System.out.println("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$");
System.out.println("int[]是否是基本数据类型"+int[].class.isPrimitive());
System.out.println("int[]是否是数组类型"+int.class.isArray());
}
}
*
*/
package package3;
import javax.management.InstanceAlreadyExistsException;
/**
* @author Administrator
*
*/
public class ClassTest {
/**
* @param args
* @throws ClassNotFoundException
*/
@SuppressWarnings("rawtypes")
public static void main(String[] args) throws ClassNotFoundException,
InstanceAlreadyExistsException,
IllegalAccessException{
String s1 = "1234";
Class c1 = s1.getClass();
Class c2 = String.class;
Class c3 = Class.forName("java.long String");
//比较字节码是否相同
System.out.println("***************************");
System.out.println("c1和c2是否是同一个对象"+(c1==c2));
System.out.println("c1和c3是否是同一个对象"+(c1==c3));
System.out.println("***************************");
//检测是否是基本数据类型
System.out.println("Steing是否是基本数据类型"+String.class.isPrimitive());
System.out.println("int是否是基本数据类型"+int.class.isPrimitive());
//检测int和INTERGER是否只想同一个字节码
System.out.println("int和integr字节码是否相同"+(int.class==Integer.class));
System.out.println("int和Integer。type的字节码是否是同一个对象"+(int.class==Integer.TYPE));
//关于数组方面的字节码
System.out.println("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$");
System.out.println("int[]是否是基本数据类型"+int[].class.isPrimitive());
System.out.println("int[]是否是数组类型"+int.class.isArray());
}
}