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 vector is used in java?
Does java runtime require a license?
What is canonical name in java?
How do you execute a thread in java?
What is n in java?
What is a functional interface?
What are the types of web technologies?
What is the program compilation process?
What is hotjava?
What is percentage in java?
What is difference between string and stringbuffer?
What is the difference between char and char *?
is it possible to instantiate the math class?
What is the use of volatile in java?
What is the dot operator?