My requirement is to get a new window with a prompt just like this:
and i am using BufferedReader for giving the input, and store the input in a string for further operations. But after executing the program it gives press any key to continue. I need the prompt to wait for another input from user. So how can i achive it someone knows about it please point me towards it. It would be a great help.
yup i can say you my problem more clearly.
I use JCreator to write and execute the code. So there i get a blank window where i should enter or give the input. I think this happens even when we run the program from command prompt. So what i need is to get a prompt just like we get in windows for example take your name. Then i should get a prompt like Greg> and i f i get the output also i should get beside that prompt only but in a new line, how can i do that.
Sorry, I don't often do console I/O, and I'm not sure I really understand your question either.
Getting prompt is easy: System.out.print("Greg> ");
Reading the input is trickier. You can just read from System.in a byte at a time, but then you have to look for the line ending yourself. It's probably better to wrap System.in in a BufferedReader or something like that.
Yep, I think you've got it ... other than misspelling my name. You prompt for some input, read it, then echo it back to the screen. Are you saying this code doesn't work, or that you want it to do something else?
Oh, that's not hard. Just put your code into a loop. You can make it an infinite loop, or define some way to exit from it. For example, keep looping until the input is "quit". Other possibilities are "exit", "bye", "end", or "hasta la vista, baby".