什么情况需要用到=new String(),为啥不直接=“字符串”,两者有啥区别
package first1;
public class _first1 {
public static void main(String[] args) {
String str="abc ABC";//教课书上是String str=new String("abc ABC")
String str2="def DEF";//教课书上是String str=new String("def DEF")
String str3=str.toLowerCase();
String str4=str2.toUpperCase();
System.out.println(str3);
System.out.println(str4);
}
}