Re: command line interface
Hi,
You can use BufferedReader screen = new BufferedReader(new InputStreamReader(System.in,
true));
Delcare the item as static and use it in your class(driver file, etc).
This is how we did it my Java classes.
Hope this helps.
Nick
"Artemis" <OutGirl25@hotmail.com> wrote:
>
>i'm pretty new at this java thing and i was wondering if someone would be
>kind enough to help me out...my question is how do you get user input from
>a command line interface? should i be using the console reader? it seems
>that i'm having problems reading strings and i'm not sure what to do. any
>suggestions? thanks!
Re: command line interface
One note, I can't remember if the second parameter for InputStreamReader is
necessary. If it gives you problems, try omitting it.
Nick
"Artemis" <OutGirl25@hotmail.com> wrote:
>
>i'm pretty new at this java thing and i was wondering if someone would be
>kind enough to help me out...my question is how do you get user input from
>a command line interface? should i be using the console reader? it seems
>that i'm having problems reading strings and i'm not sure what to do. any
>suggestions? thanks!
Re: command line interface
Hi
BufferedReader cin=new BufferedReader(new InputStreamReader(System.in));
String s=cin.readLine();
or
DataInputStream cin=new DataInputStream(System.in);
String s=cin.readLine();
but readLine method in DataInputStream is deprecated
Regards
Raj
"Nick" <ned1972@hotmail.com> wrote:
>
>One note, I can't remember if the second parameter for InputStreamReader
is
>necessary. If it gives you problems, try omitting it.
>
>Nick
>
>
>
>
>
>"Artemis" <OutGirl25@hotmail.com> wrote:
>>
>>i'm pretty new at this java thing and i was wondering if someone would
be
>>kind enough to help me out...my question is how do you get user input from
>>a command line interface? should i be using the console reader? it seems
>>that i'm having problems reading strings and i'm not sure what to do. any
>>suggestions? thanks!
>