dcsimg
java console system.in confusion
3 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Ivn_Tcakov
Posted On:   Monday, January 7, 2002 11:29 AM

Hello,
I am running a java APplet with a java console displayed beside it.
I would like to do some command-line input coding
and I have found all the System.in and Sustem.out stuff
but I can't figure out where the INPUT is typed in?
The System.out prints in the java console, but where does
System.in take the input from?
i'd appreciate any hints.
thanks
Ivan

Re: java console system.in confusion

Posted By:   David_Young  
Posted On:   Saturday, February 23, 2002 10:00 AM

Hi Ivan,


I was looking for the same info on command-line input and found this descriptive page with examples.


-David

Re: java console system.in confusion

Posted By:   adel_suhaim  
Posted On:   Monday, January 21, 2002 07:11 PM

I think that u type the input from the keyboard....

u have a class called BufferedReader u use it like :

BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)) ;

this makes an object named stdin...
the class BufferedReader has only one method that reads String only that method is readLine() so u use it like


String myVariable = stdin.readLine() ;

u can make use for it when intering numbers like ....

int i= Integer.parseInt(stdin.readLine());


But why would you use the console reading !!! u could have used JOptionPane that uses GUI to enter the value :

showInputDialog(Component parentComponent, Object message)

Example :

JOptionPane.showInputDialog(null,"Enter a Value");


Making the parent component to be NULL will center the Dailog box into the screen


I hope this was helpful

Adel

Re: java console system.in confusion

Posted By:   Christopher_Schultz  
Posted On:   Monday, January 7, 2002 12:35 PM

Chances are that your applet will not have access to standard in. If you run the appletviewer from the command-line, then you can probably use the xterm (or cmd) window as your standard in.



-chris
About | Sitemap | Contact