public int length():获取字符串当中含有的字符个数,拿到字符串长度。

1 public class String01 {
2     public static void main(String[] args){
3         //获取字符串的长度
4        int lengh =  "HBQ".length();
5        System.out.println("字符串的长度是"+lengh);
6     }
7 }

 

posted @ 2020-03-14 19:52  HuangBingQuan  阅读(334)  评论(0编辑  收藏  举报