Scanner substitution in 1.4
- From: "rudi.triglav@xxxxxxxxx" <rudi.triglav@xxxxxxxxx>
- Date: 27 Mar 2007 23:13:25 -0700
Hello,
I'm new to java. It has been only two weeks since I had my first cup.
I use the java.util.Scanner class in my 1.5 app's to read and validate
the user input form command prompt. Now I'm trying to do the same with
1.4 which hasn't got the Scanner class. I'm using:
BufferedReader in = new BufferedReader(new
InputStreamReader(System.in));
System.out.print("Enter age: ");
int name = Integer.parseInt(in.readLine());
to read the user input but I don't know how to validate the data. In
1.5 where I can use the Scanner class I can use the hasNexInt() method
to validate the Integer input. How can I do the same thing in 1.4?
Please help.
.
- Follow-Ups:
- Re: Scanner substitution in 1.4
- From: Andrew Thompson
- Re: Scanner substitution in 1.4
- Prev by Date: Re: Generate Website(HTML) thumbnails on the fly
- Next by Date: Re: Getting currency on a specific day ?
- Previous by thread: problem with applet access to web service
- Next by thread: Re: Scanner substitution in 1.4
- Index(es):
Relevant Pages
|
|