Java Program to print integers you have input through console using BufferedReader and StringTokenizer
import java.util.*;import java.io.*;class Buf_R_Str_Token{ public static void main(String args[]) throws IOException{ BufferedReader b_r = new BufferedReader(newInputStreamReader(System.in)); String str = b_r.readLine(); StringTokenizer st = new StringTokenizer(str, ","); String item; try{ while((item = st.nextToken()) != null){ System.out.print(" " + item); } } catch(Exception e){ System.out.println("\n End of String."); } }}
Comments
Post a Comment
share your thoughts ....