🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #19363

read doubles from console

#19363
From: angus fraser
Date: Sun, 15 Feb 1998 00:00
25 lines
1096 bytes
Hi,

A beginners type question.

I want to read 2 double(temperature) values entered via the console(it's a 
fairly trivial console program) but I can't get it to work using the 
following :-

double dry ;
double wet ;
try {
     DataInputStream dis = new DataInputStream( System.in );
     System.out.println("Enter Temp 1 > ");
     dry = dis.readDouble();
     System.out.println("Enter Temp 2 > ");     
     wet = dis.readDouble();
    }
    catch ( IOException e ) { }

What is the correct way to read float/double values entered via a console 
window
---
angus fraser
java@afraser.cix.co.uk
Technical Details
Message-ID: <memo.19980215231440.217A@afraser.cix.co.uk>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,c6c624e45e8aa49f,start
X-Google-Attributes: gidf74b3,public
From: java@afraser.cix.co.uk (angus fraser)
Subject: read doubles from console
Date: 1998/02/15
Message-ID: <memo.19980215231440.217A@afraser.cix.co.uk>
X-Deja-AN: 325377243
Organization: afraser@cix
X-URL: http://www.ameol.com
X-News-Software: Ameol2
Reply-To: java@afraser.cix.co.uk
Newsgroups: borland.public.jbuilder.java.language