位于java.lang包中
String 类对象中的内容一旦被初始化就不能再改变
StringBuffer类用于封闭内容可以改变的字符串
用toString方法转换成String类型
String x="a"+4+"c"编译时等效于
String x= new StringBuffer().append("a").append(4).append("c").toString();
字符串常量(如"hello")实际上是一种特殊的匿名String对象.
String s1="hello"; String s2="hello";
s1==s2 ture;
String s1=new String("hello"); String s2= new String("hello");
String 类对象中的内容一旦被初始化就不能再改变
StringBuffer类用于封闭内容可以改变的字符串
用toString方法转换成String类型
String x="a"+4+"c"编译时等效于
String x= new StringBuffer().append("a").append(4).append("c").toString();
字符串常量(如"hello")实际上是一种特殊的匿名String对象.
String s1="hello"; String s2="hello";
s1==s2 ture;
String s1=new String("hello"); String s2= new String("hello");