How could Java classes direct program messages to the
system console, but error messages, say to a file?
Answer Posted / biru3121
The class System has a variable out that represents the
standard output, and the variable err that represents the
standard error device. By default, they both point at the
system console. This how the standard output could be re-
directed:
Stream st = new Stream(new FileOutputStream("output.txt"));
System.setErr(st);
System.setOut(st);
| Is This Answer Correct ? | 6 Yes | 1 No |
Post New Answer View All Answers
Why java does not support pointers?
What loop means?
What are the data types supported by java? What is autoboxing and unboxing?
What is empty list in java?
What are some examples of variable costs?
What are the four integer types supported by java?
What do you know about the garbage collector in java?
What is the super void?
Which category the java thread do fall in?
State some advantages of java?
Do loops java?
When wait(), notify(), notifyall() methods are called does it releases the lock or holds the acquired lock?
what is the difference between yielding and sleeping? : Java thread
What is a parameter in a function?
Why there are some null interface in java? What does it mean?