String, text, numbers, I/O I part
String currentLine;
while( (currentLine = bufferedReader.readLine()) != null ){
System.out.println(currentLine);
}
}
}
Q: Does anybody know a convenient way to pause the dos program execution
until user hits enter? In C I used getc. Does Java have an equivalent of "cin>>"?
Answer:
try {
System.in.read()
} catch (Exception e) {
}
Have fun!
Bary
I ve got a (simple) menu on a new application and am trying to put in the works
behind the cut, copy & paste menu options does anyone know how I can do this
what s the code or can you point me in the right direction?
Answer: Look at java.awt.datatransfer package. It contains much of the tools
necessary to implement cut. copy, paste.
Can anyone please explain clearly how BufferedReader works and how to use it to
get input from a keyboard?
Q: Can anyone please explain clearly how BufferedReader works and how to
use it to get input from a keyboard?
Answer: BufferedReader is a filter reader class.
That is, it wraps another reader and reading from it is like reading from the reader it
wraps, except that it changes something. In the case of BufferedReader, it reads in
large chunks and then you can retrieve its data in smaller bits. To use it to read from
System.in, you first need a reader to wrap. You can bridge from an input stream
(which System.in is) to a reader by using an InputStreamReader.
Then wrap that in a BufferedReader as follows:
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
Now you can call methods of BufferedReader to read from standard input. Generally,
you create a BufferedReader to be able to call the readLine() method. That isn t
BufferedReader s main intended use the main intended use is performance but
you don t generally care too awfully much about performance of reads from the
console. So call readLine to get a line of input, which will be null on end of stream
(user presses Ctrl D on UNIX or a file was redirected in and is done).
answered by Chris Smith
How do I encode the value of a variable of type long (or int) into bytes? And how
do I restore the original value of the long (or int) variable back
How do I encode the value of a variable of type long (or int) into bytes such that the
number of bytes used will always be the same, say 4 bytes?
file:///F|/a_jsite/350_tips/stings_text__date_numbers_io I.htm (2 of 7) [2001 07 08 11:24:59]
footer
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved