集册 Java实例教程 获取字符串长度

获取字符串长度

欢马劈雪     最近更新时间:2020-01-02 10:19:05

500
提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
获取字符串长度
/* 来自 N o w  J a v a  .   c o m*/


 

public class Main {

 

  public static void main(String[] args) {

    String str = "Hello World";

   

    int length = str.length();

    System.out.println("Length of a String is : " + length);

  }

}