willisoften Posted October 5, 2003 Report Share Posted October 5, 2003 BufferedReader keyboard = new BufferedReader(new InputStreamReader(System.in)); double rate = Double.valueOf(keyboard.readLine()).doubleValue(); This looks so clumsy I was wondering if there was a better way to do it? I haven't really fetched all that much input from the keyboard as I had a package from the university which did it for me. This however looks like a lot of code compared to C. Quote Link to comment Share on other sites More sharing options...
fuzzylizard Posted October 6, 2003 Report Share Posted October 6, 2003 Not really. Getting keyboard input from the command line in Java is a rather clumsy thing and setting up stream readers is really the only way of doing it. However, once you start doing GUI programming, things become a lot easier. If you want a link detailing the different ways of doing I/O in java check this out: http://www.fuzzylizard.com/articles/java-io.cfm Quote Link to comment Share on other sites More sharing options...
willisoften Posted October 6, 2003 Author Report Share Posted October 6, 2003 Thanks, I was just wondering -think I'll set up my own class for input then. The one I got from the university doesn't work with Linux though it should so I was trying to do input myself. Cheers Will Ps Thanks for the link too Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.