java中String和StringBuffer解析.docVIP

  • 1
  • 0
  • 约1.09万字
  • 约 8页
  • 2017-05-20 发布于北京
  • 举报
java中String和StringBuffer解析

在控制台上输入用Scanner类的对象。 String 字符串,String类型的数据是不可以改变的 String s1 = Hello; String s2 = World; String s3 = Hello; System.out.println(s1==s2);//false 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));//true String s1 = “abc”; S1 = “a”; String s1 = Hello; String s2 = World; s1 = s1 + s2; StringBuffer可变长字符串 。 indexOf(int) - 类 java.lang.String 中的方法 返回指定字符在此字符串中第一次出现处的索引。 indexOf(int, int) - 类 java.lang.String 中的方法 从指定的索引开始搜索,返回在此字符串中第一次出现指定字符处的索引。 indexOf(String) - 类 java.lang.Strin

文档评论(0)

1亿VIP精品文档

相关文档