/** * @author lautturi.com * Java example: get array of strings from console input */ import java.util.*; public class Lautturi { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String[] words = scanner.nextLine().split(" "); for (String str : words) { System.out.println(str); } } }
output:
hello java world<enter> hello java world