I am using BufferedReader class to read inputs in my Java program. I want to read inputs from a user who can enter multiple integer data in single line with space. I want to rea
You can use StringTokenizer class of java.util package. The StringTokenizer class allows an application to break a string into tokens. You can use this tokens using nextToken() method of StringTokenizer class.
You can use following constructor of StringTokenizer:
StringTokenizer(String str, String delimiter);
you can use space(" ") as delemeter.
int a[] = new int[N];
StringTokenizer st = new StringTokenizer(br.readLine() , " ");
for(int i=0 ; i