You are viewing a single comment's thread. Return to all comments →
More efficient then scanner and a bit faster although this is a small code so there will be not much big difference
public static void main(String[] args)throws IOException { int i=1; String str = ""; BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); while((str=in.readLine())!=null){ System.out.println(i+" "+str); i++; } }
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 →
More efficient then scanner and a bit faster although this is a small code so there will be not much big difference