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 is an inner class in java?
Explain the importance of thread scheduler in java?
Explain about narrowing conversion in java?
what is the messsage u r going to get from an objectoriented programing?
Is list thread safe in java?
Will the compiler creates a default constructor if I have a parameterized constructor in the class?
Explain the features of java?
Explain the JDB in depth & command line.
How many threads does a core java have?
What is array initialization in java?
What are the core java topics?
What is the purpose of the file class in java programming?
What is ellipsis in java?
Can we override private method in java?
Can we declare a class as static?