• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to save char user input?  RSS feed

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
code:
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!
 
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I don't see any statements here that read input from System.in; I only see you printing a prompt. JDKs prior to 1.27 (due out in Q3 of 2014) don't have the java.ai.natural.language 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.
 
nil lin
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!!
 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My friend you really need to do a basic tutorial. Try starting here:
http://java.sun.com/docs/books/tutorial/index.html

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

Jon
 
I have always wanted to have a neighbor just like you - Fred Rogers. Tiny ad:
The WEB SERVICES and JAX-RS Course
https://coderanch.com/t/690789/WEB-SERVICES-JAX-RS
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!