File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes multiple inputs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "multiple inputs" Watch "multiple inputs" New topic

multiple inputs

nick kaushik
Ranch Hand

Joined: Sep 25, 2009
Posts: 48

i m building a program in core java which replaces chars in a text for user defined chars.for this i want the program to ask user as many time as he wants.program asks for both replaced as well as replacement & make changes to text?

"ye shall know the truth & the truth shall set you free..."
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10825

Welcome to the Ranch.

How does your application interface with the user? Command line? Standalone GUI? Webpage?

In pseudo code
1) Request user input
2) Process user input
3) Confirm repeat from user.

A command line interface would involve running a while loop. A GUI would involve a confirmation dialog.

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
nick kaushik
Ranch Hand

Joined: Sep 25, 2009
Posts: 48

i want to just do it-commandline or otherwise.although i used bufferedReader object.i used 3 different char for replaced,replacement & replace again? inputs & put them in do-while loop.....
nick kaushik
Ranch Hand

Joined: Sep 25, 2009
Posts: 48

i m beginner, i m doing it on command prompt..
nick kaushik
Ranch Hand

Joined: Sep 25, 2009
Posts: 48

well Manish, sorry its just that i didnt got a satisfying reply last i posted the program.
i request you to delete tht last post & continue the program one...
Sean Clark

Joined: Jul 15, 2009
Posts: 377

This is the code from the other message.
I tested it and it works ok.

The only thing I would change for this simple app is maybe add in some simple validation - check they have entered a char otherwise ask them again.

and also just use one BufferedReader to read in the values, you don't need 3.


I love this place!
Vivek Kr Singh
Ranch Hand

Joined: Oct 12, 2007
Posts: 56
check java.util.Scanner from JDK 5.0

SCJP 1.4
I agree. Here's the link:
subject: multiple inputs
jQuery in Action, 3rd edition