HDTutorial
EN

Playback starts YouTube’s embedded player (privacy-enhanced mode).

How to find the length of a String using the Java String length() method - Java Tutorial

690 views May 12, 2020 6:51

Watch on YouTube
ChannelCoding River

Description from the creator

How to find the length of a String using the Java String length() method - Java Tutorial For Absolute Beginners

In this video, we will learn to use the Java String length() method. With this method, we can be able to find out the length of a String.
What this method does is that it counts the number of characters in a String including the white spaces. After counting all the characters it returns an integer number representing the total number of characters in a given String
Example
public class LengthExample{
public static void main(String args[]) {
String sentence1 = "Hello World !";
String sentence2 = "My name is Kely";

System.out.println("Length of String 1 = "+sentence1.length());
System.out.println("Length of String 2 = "+sentence2.length());

}
}


#codingriver
#java
#programmi

About this tutorial

Coding River published this 6:51 video tutorial on May 12, 2020. It has been watched 690 times on YouTube.

Category
Education
Duration
6:51
Published
May 12, 2020
Views
690
Likes
7

Tags

Share

This tutorial in other languages