Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

about Readline()

 
y bin
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how can I let usr input three number continuously and assign to various
variable?
this is part of the program,any body can teach me?thanks
--
try{
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br =new BufferedReader(isr);
System.out.println("please input [n, a_min, a_max]: ");
n = Integer.parseInt(br.readLine());??
 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the input is like 'n, a_min, a_max' then you have a String that you need to split up first with e.g. a StringTokenizer.
e.g.

Ren´┐Ż
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic