The program defines a public class named "String_Length" with a main method that takes no arguments. The main method declares a String variable str with the value "Java Exercise".
Then, the program uses the length() method of the String class to calculate the length of str and stores the result in the integer variable len.
Finally, the program prints out the original String str and the resulting length len using the System.out.println method.
public class String_Length { public static void main(String[] args) { String str = "Java Exercise"; int len = str.length(); System.out.println("Given String : "+str); System.out.println("String Length : "+len); } }
Given String : Java Exercise String Length : 13
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions