Article View: borland.public.jbuilder.java.language
Article #14836Simple cin for java?
From: Trey Ethridge
Date: Wed, 28 Jul 1999 00:00
Date: Wed, 28 Jul 1999 00:00
16 lines
1274 bytes
1274 bytes
Hello everyone, I'm new to java and so far I like it a lot! I usually program in C++ so it wasn't much of a stretch to switch over. However, the hardest thing that I have had to do so far is simply get some text from a user in a console application. For instance, if I wanted to just get floats from the user to calculate some statistical number. How could I get the float value. In C++ you could just say something like cin>>floatValue; I know it's not that simple in java, because I've gotten it to work, but I think that there has to be an easier way. I read in a string using a BufferedReader buf = new BufferedReader(new InputStreamReader(System.in)); file = buf.readline(); Is there a simple way to get native types and how do I know the best time to use which stream? Thanks, Trey Ethridge
Technical Details
Message-ID:
<7no9he$8tf7@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,463c059acd79ff44,start X-Google-Attributes: gidf74b3,public From: "Trey Ethridge" <ethridgt@db.erau.edu> Subject: Simple cin for java? Date: 1999/07/28 Message-ID: <7no9he$8tf7@forums.borland.com> X-Deja-AN: 506411501 Organization: Another Netscape Collabra Server User Newsgroups: borland.public.jbuilder.java.language X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3