第十五章
1.String类
创建对象
String s = “Hello World”;
String s = new String();
String s = new String(“Hello World”);
常用方法
获得字符串的长度:length()
比较字符串:equals()
连接字符串:concat()
提取字符串:substring()
搜索字符串:indexOf()
拆分字符串:split()
2.StringBuffer类
创建对象
StringBuffer sb = new StringBuffer();
StringBuffer sb = new StringBuffer(“bdqn");
常用方法
转换成String类型:toString()
连接字符串:append()