向控制台输入,使用Scanner类,在java.util包下
String类型的数据是不能够被改变的,因为String是final修饰的
String s1 = "Hello";
String s3 = "Hello";
System.out.println(s1==s3);//true
String s4 = new String("Hello");
String s5 = new String("Hello");
System.out.println(s4==s5);//false
System.out.println(s4.equals(s5));
String s1 = “Hello”;
S1 = “abc”;
StringBuffer可变长字符串
String s1 = "Hello";
s1 = s1 + "World";