//For continues reading a line import java.util.Scanner; Scanner in = new Scanner(System.in); while(in.hasNextLine()) { String line = in.nextLine(); System.out.println("Next line is is: " + line); }