How to Find String Length in Java

How to Find String Length in Java

Here you will get program code to find string length in java by using 2 different ways.

1. using length() method

2. without using length() method

Program to Find String length in java using length()

Output

C:\CodeRevise\java>javac FindStringLength.java

C:\CodeRevise\java>java FindStringLength
Enter a string : Coderevise.com
The length of the string is: 14

 

Find String length in Java without using length()

Output

C:\CodeRevise\java>javac FindStringLength.java

C:\CodeRevise\java>java FindStringLength
Enter a string : Welcome to Code Revise
The length of the string is: 22

 

 

 

Check out our other Java Programming Examples

 

 

 

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top