Java program to find the length of a given string
KW.java
Output
kodingwindow@kw:~$ javac KW.java
kodingwindow@kw:~$ java KW ——————————————————————————————————————————— Program to find the length of a given string ——————————————————————————————————————————— Enter the string Hello, World! Entered string is Hello, World! The length of (Hello, World!) = 13 ——————————————————————————————————————————— kodingwindow@kw:~$
Java program to find the length of a given string
KW.java
Output
kodingwindow@kw:~$ javac KW.java
kodingwindow@kw:~$ java KW Length of a string is: 12 kodingwindow@kw:~$
What Next?
How to find the length of a string without using the length method in java
Java program to reverse a given string using the reverse method
Java program to reverse a given string using charAt method
Advertisement