Write a java program to get the length of a given string.

Java Programming Language / String in java

953

Program:

public class Exercise {
public static void main(String[] args)
  {
    String str = "example.com";
    // Get the length of str.
    int len = str.length();
    System.out.println("The string length of '"+str+"' is: "+len);
   }
}

Output:

The string length of 'example.com' is: 11
Press any key to continue . . .

Explanation:

None

This Particular section is dedicated to Programs only. If you want learn more about Java Programming Language. Then you can visit below links to get more depth on this subject.