how to get i/p seperated by space?
eg 3423 43234
can u give me the syntax for doing so?

  • created

    Mar '07
  • last reply

    Mar '07
  • 1

    reply

  • 170

    views

  • 2

    users

If theres not much input, you can just use a Scanner (sc), and use sc.nextInt(), int.
If theres a lot of input, thats far too slow, so I use a BufferedReader (br), and then split() the string. For example,

String[] inputParts = br.readLine().trim().split("\\s++");

where that regular expression means 'one or more whitespace'.

Suggested Topics

Want to read more? Browse other topics in JAVA based languages or view latest topics.