This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes How to save char user input? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to save char user input?" Watch "How to save char user input?" New topic

How to save char user input?

nil lin

Joined: May 04, 2004
Posts: 4
char c=0;
System.out.println("Do you want to continue?y/n"+c);

why JAVA didn't let me key in y or n?

thanks for answer!
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199


I don't see any statements here that read input from; I only see you printing a prompt. JDKs prior to 1.27 (due out in Q3 of 2014) don't have the package, and so won't be able to automatically read the text of the prompt and figure out that you mean to have the user type something, so you'll have to explicitly do it yourself.

[Jess in Action][AskingGoodQuestions]
nil lin

Joined: May 04, 2004
Posts: 4
mn...I write another one

char c;
System.out.println("DO you want to continue?y/n"+getParameter(c));

1 error..........

WHERE the WRONG is???

thanks for answer!!
Jon Poulton

Joined: Jun 09, 2004
Posts: 27
My friend you really need to do a basic tutorial. Try starting here:

Do "Getting Started" followed by "Learning the Java Language" and go from there.

I agree. Here's the link:
subject: How to save char user input?
It's not a secret anymore!