Get String Length - Java Language Basics

Java examples for Language Basics:String

Description

Get String Length

Demo Code


 
public class Main {
 
  public static void main(String[] args) {
    String str = "Hello World";
   //from   w  w  w.  j a  v  a 2s.com
    int length = str.length();
    System.out.println("Length of a String is : " + length);
  }
}

Result


Related Tutorials