Best way to get user input from the console window?

S

Sean W

Hey everyone,

I'm a freshman in college and I'm currently learning java for one of my
classes. I know this question is really simple, but I've seen a number
of different ways to do this, and the example my teacher provided
didn't exactly work...

Any Suggestions?

(I'm new to mailing list groups as well. I got sick of all the flaming
and non-useful posts with conventional forums)
 
A

Andrew Thompson

Sean W wrote:
....
I'm a freshman in college and I'm currently learning java for one of my
classes. I know this question is really simple, but I've seen a number
of different ways to do this, and the example my teacher provided
didn't exactly work...

Lazy, was it? Did you try cash inducements, or
threats of restrictions of liberty? That often scares
input methods into line..

Or, to put that another way, please be clear, specific
and *precise* with all code and test output.

Otherwise you might get suggestions like..
Any Suggestions?

Change the ',' to a '.' on line 46.
(I'm new to mailing list groups as well.

This is known as a 'usenet newsgroup', just in case
there is any confusion.
..I got sick of all the flaming
and non-useful posts with conventional forums)

(chuckle) Define 'flame'?

I've done about three in my lifetime, but have been
accused of hundreds.

But to ge to the meat of your query, I generally
prefer a JOptionPane for quick input from the CLI.
It won't work in 'old java', but that usually does
not matter.

OTOH, I think it would be far more productive (and
instructive) to figure out why the teacher's method
did not 'work', so.. Back to you.

Andrew T.
 
O

Oliver Wong

Sean W said:
Hey everyone,

I'm a freshman in college and I'm currently learning java for one of my
classes. I know this question is really simple, but I've seen a number
of different ways to do this, and the example my teacher provided
didn't exactly work...

Any Suggestions?

The reason you've seen a number of different ways to do this is that
there are a number of different ways to do it, and they each have their own
quirks. As Andrew suggested, it's probably best if you do it the way the
teacher wants you to do it, or else you may run into problems in future
assignments when the quirks of the teacher's way won't match up with the
quirks of the way you end up using.
(I'm new to mailing list groups as well. I got sick of all the flaming
and non-useful posts with conventional forums)

comp.lang.java.programmer is a newsgroup, so you might want to read
http://kb.iu.edu/data/abcy.html

- Oliver
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top