首页 > 代码库 > String 学习1(split valueof)

String 学习1(split valueof)

Strings are constant; their values cannot be changed after they are created

  String s1 = "Hello";
  String s2 = "Hello";
  System.out.println(s1==s2); //true
  
  String s3 = new String("Hello");
  String s4 = new String("Hello");
  
  System.out.println(s3 == s4); //false
  System.out.println(s3.equals(s4)); //true
  
  char [] a = {‘a‘,‘b‘,‘c‘ ,‘d‘};
  String s5 = new String(a);
  String s6 = new String(a,1,3);
  System.out.println(s5);
  System.out.println(s6); //bcd

public String[] split(String regex)

String 学习1(split valueof)