[3154] in java-interest

home help back first fref pref prev next nref lref last post

Re: Stumped by simple input

daemon@ATHENA.MIT.EDU (Thomas Ball)
Wed Nov 1 19:28:38 1995

Date: Wed, 1 Nov 1995 12:51:22 -0800
From: Thomas.Ball@Eng.Sun.COM (Thomas Ball)
To: dkumar@blackcat.brynmawr.edu
Cc: java-interest@java.Eng.Sun.COM

>  I have been stumped by a simple "how to" in Java. How does one read
>  a number (be it a integer or a float) from keyboard in a stand alone java
>  program?

	String line = in.readLine();
	try {
		int i = Integer(line).intValue();
	} catch (NumberFormatException e) {
		System.out.println(line + " is not a valid integer.");
	}

Tom Ball
Java Products Group
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post