public class A { //创建类
public static void main(String[] args) { //主方法
String str = new String("the Study of a FOREIGN "); //创建一个String类的对象str
System.out.println(str);//输出str
}
}
public TestString { //创建测试类
public static void main(String[] args) { //主方法
String str = new String("the Study of a FOREIGN "); //创建一个String类的对象str
}
}
String src=new String(“"the Study of a FOREIGN ”);
这种内存里有2个string
String str="the Study of a FOREIGN" ;
内存里只有一个String
String str = new String("the Study of a FOREIGN");
String str="the Study of a FOREIGN" ;