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
If a class is declared without any access modifiers, where can the class be accessed?
How is it possible for two string objects with identical values not to be equal under the == operator?
What is variable explain?
What are the six ways to use this keyword?
What is local variable and instance variable?
Why do we use bufferedreader?
Explain about complier design(phases)
What is time complexity algorithm?
Write code to implement bubble sort in java?
What is the byte order of byte buffer?
What is an immutable object? How do you create one in java?
what is the messsage u r going to get from an objectoriented programing?
What is null statement?
What do you mean by inner class in java?
Who found java?