3. 编写一个Java程序,完成如下功能: (1) 创建一个String类的对象str,内容为: "the Study of a FOREIGN l

2025-02-27 20:09:34
推荐回答(5个)
回答1:

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
}
}

回答2:

public TestString { //创建测试类
public static void main(String[] args) { //主方法
String str = new String("the Study of a FOREIGN "); //创建一个String类的对象str
}
}

回答3:

String src=new String(“"the Study of a FOREIGN ”);
这种内存里有2个string
String str="the Study of a FOREIGN" ;
内存里只有一个String

回答4:

String str = new String("the Study of a FOREIGN");

回答5:

String str="the Study of a FOREIGN" ;