/** * @author lautturi.com * Java example: get first letter of string in array */ import java.util.*; public class Lautturi { public static void main(String[] args) { String[] strArray = {"hello","lautturi","java","python","world","lau"}; for (String str: strArray) { System.out.println(str.charAt(0)); } } }
output:
h l j p w l