@Test public void testString(){ /*字符串处理 */ String email="123456789@qq.com"; System.out.println("字符串长度 "+email.length()); System.out.println(email.indexOf("@")); System.out.println(email.substring(0, email.indexOf("@"))); System.out.println(email.toLowerCase()+" "+email.toUpperCase()); String[]arrayStr=email.split("@"); for (String temp:arrayStr){ System.out.println(temp); } /*==比较的是内存的地址 equals比较的是值 */ String str1=new String("123");String str2=new String("123"); System.out.println(str1==str2); System.out.println(str1.equals(str2)); /*存的是常量值*/ String str3="123";String str4="123"; System.out.println(str3==str4); System.out.println(str3.equals(str4)); }