/** * @author lautturi.com * Java example: iterate over string in java */ import java.util.*; public class Lautturi { public static void main(String[] args) { String str = "hello lautturi.com java world!"; for (int i = 0; i < str.length(); i++){ char c = str.charAt(i); System.out.print(c+" "); } } }
output:
h e l l o l a u t t u r i . c o m j a v a w o r l d !