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
What are the advantages of arraylist over arrays?
What is treemap in java?
a thread is runnable, how does that work? : Java thread
Why should I use abstract class?
What are format specifiers in java?
Which package is always imported by default?
Write a program in java to create a doubly linked list containing n nodes.
What is the largest long allowed by java?
How is it possible in java programming for two string objects with identical values not to be equal under the == operator?
Explain the difference between serializable and externalizable in java?
How many types of voids are there?
Why do we declare a class static?
What is xslt in java?
What is initial size of arraylist in java?
What is the generic class?