62,628
社区成员
发帖
与我相关
我的任务
分享
String s1 = new StringBuilder("floa").append("t").toString();
System.out.println(s2.intern() == s2);
String s2 = new StringBuilder("go").append("od").toString();
System.out.println(s1.intern() == s1);
/**
* The {@code Class} instance representing the primitive type
* {@code float}.
*
* @since JDK1.1
*/
@SuppressWarnings("unchecked")
public static final Class<Float> TYPE = (Class<Float>) Class.getPrimitiveClass("float");
看到了没,"float"。
=====
再给你看看Integer的:
/**
* The {@code Class} instance representing the primitive type
* {@code int}.
*
* @since JDK1.1
*/
@SuppressWarnings("unchecked")
public static final Class<Integer> TYPE = (Class<Integer>) Class.getPrimitiveClass("int");
======
其它的例子我就不举了。