首页 > 技术文章 > 返回字符串的长度

hph1728390 2019-03-18 21:49 原文

  public class ZongHe {
    public static void main(String[] args) {

        //调用function;

          function();

  }

   //int length();返回的是字符串长度
        public static void function(){
            String Str="skeji";  //定义字符串
            int  l=Str.length();  //计算字符串的长度赋值
            System.out.println(l);  //打印
    }
    
}

推荐阅读