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
In questa pagina del sito puoi guardare il video online How to find the length of a String using the Java String length() method - Java Tutorial della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Career & Tech HQ 10 maggio 2020, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 655 volte e gli è piaciuto 7 spettatori. Buona visione!