+ 3
Something like this may be what you're looking for: import java.util.Scanner; import java.util.List; import java.util.ArrayList; public class Program { public static void main(String[] args) { Scanner sc = new Scanner(System.in); List<String> list = new ArrayList<>(); String str = ""; while(true) { str = sc.nextLine().trim(); if(str.toLowerCase().equals("end")) break; list.add(str); } for(String s: list) { System.out.println(s); } sc.close(); } }
3rd Nov 2017, 4:29 AM
ChaoticDawg
ChaoticDawg - avatar