You are viewing a single comment's thread. Return to all comments →
public class Solution {
public static void main(String[] args) { int i = 1; ArrayList<String> light = new ArrayList<>(); String EOF = "end-of-file"; Scanner scan = new Scanner(System.in); while (scan.hasNextLine()){ String token = scan.nextLine(); if(token.toLowerCase().contains(EOF.toLowerCase())){ light.add(token); break; } light.add(token); } for(String line : light){ System.out.println( i + " " + line); i++; } scan.close(); }
Seems like cookies are disabled on this browser, please enable them to open this website
Java End-of-file
You are viewing a single comment's thread. Return to all comments →
public class Solution {