How to use while(value) so that it executes as long as the value is not null?
What does bw.flush actually do?
Ulf Dittmer wrote:
How to use while(value) so that it executes as long as the value is not null?
while (value != null) {
...
}
What does bw.flush actually do?
It causes all the data that you have written to the Writer to be sent to its destination. A BufferedWriter buffers things, so whatever you write to it may not get sent to its destination right away - flush makes sure it does.
And one important thing: Strings are compared using the equals method, not using the "==" or "!=" operators. You need to change those 3 lines of code.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."
--- Martin Fowler
Paul Clapham wrote:The easiest way is for the message sender to first send the number of bytes (in an int, for example) and then send the bytes. The receiver would receive the number of bytes, create an array of that size, and then receive the bytes into that array.
Don't get me started about those stupid light bulbs. |