Java standard class simple memo Method to count the number of characters 【length】 How to use: Variable = String Variable.length ();
//ex)
public static void main(String[] args){
//Store ABCDEFGHI in String variable word
String word = "ABCDEFGHI";
//Pull the length of the number of characters to the int variable countWord
int countWord = word.length();
//Show int variable
System.out.println(countWord);
//Direct display
System.out.println(word.length());
}
Recommended Posts