Java count the number of letters in a string array

h‮sptt‬://www.lautturi.com
Java count the number of letters in a string array
/**
 * @author lautturi.com
 * Java example: count characters in a string array in java
 */

import java.util.*;

public class Lautturi {
	

	public static void main(String[] args) {

		String[] strArray = {"hello","lautturi","java","python","world","lau"};

	    // printing number of words in array
	    System.out.println("Number of words in array: " + strArray.length);

	    int lettersCounter=0;
	    for (int counter = 0; counter < strArray.length; counter++) {
	        lettersCounter += strArray[counter].length();
	    }
	    System.out.println("Number of characters in array:"+lettersCounter);
	}
}

output:

Number of words in array: 6
Number of characters in array:31
Created Time:2017-09-09 09:52:18  Author:lautturi