周三周四String类的概述和使用(1)多个字符组成的一串数据。 其实它可以和字符数组进行互相交换 。(2)构造方法: public String()public String(byte{} bytes)public String(byte{} bytes,int offset,int length)public String(char{} value)public String(char{} value,int offset,int count)public String(String original)字符串的特点 2.字符串一旦被赋值就不能改变 注意:这里指的是字符串的内容不能改变,而不是引用不能改变 。1.字面值作为字符串对象和通过构造方法创建对象的不同 字符串的功能 A:判断功能boolean equals (0bject obj) boolean equalsIgnoreCase (String str) boolean contains (String satr) boolean startsWith (String str) boolean endsWith (String str) boolean isEmpty() B:获取功能 int length() char charAt (int index) int indexOf (int ch) int indexOf (string stE) int indexOf (int ch,int fromIndex) int indexOf (String str, int fromIndex) String substring (int start) String substring(int start,int end)转换功能 D其他功能a替换功能 b:去空格功能c:按字典比较功能(6)字符串的案例A:模拟用户登录B:字符串遍历C:统计字符串中大写,小写及数字字符的个数D:把字符串的首字母转成大写,其他小写E:把int数组拼接成一个指定格式的字符串 F:字符串反转G:统计大串中小事出现的次数