Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Beginning Java
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Beginning Java
User inputs
Jools Birch
Greenhorn
Posts: 6
posted 20 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I'm wondering how you would go about making a program that prints out a users input.
Could I have code for it?
Ernest Friedman-Hill
author and iconoclast
Posts: 24207
46
I like...
posted 20 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
public class Echo { public static void main(String[] unused) throws Exception { int c; while ((c = System.in.read()) != -1) System.out.write(c); } }
But of course, this isn't what you're really after. Want to be more specific?
[Jess in Action]
[AskingGoodQuestions]
Jools Birch
Greenhorn
Posts: 6
posted 20 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Like this
Prompt user to enter a text "Enter something"
Once the user presses Enter,
whatever the user has inputted is displayed.
Ernest Friedman-Hill
author and iconoclast
Posts: 24207
46
I like...
posted 20 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Not to give it all away for free...
Prompt by printing to System.out, of course. Read a line by wrapping System.in in an InputStreamReader and a BufferedReader in turn, then calling BufferedReader.readLine(). Then print the result to System.out.
[Jess in Action]
[AskingGoodQuestions]
Jools Birch
Greenhorn
Posts: 6
posted 20 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Why not "give away for free", it's not that much of a program is it?
William Barnes
Ranch Hand
Posts: 1067
2
I like...
posted 20 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Free code
Please ignore post, I have no idea what I am talking about.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
taking value w/o submit
Please can someone explain how I can take user input and pass it to another vairable?
Update a program input after running
JMS reliability
Is there a possible way to use index properties on this situation
More...