How could Java classes direct program messages to the
system console, but error messages, say to a file?
Answer Posted / munna
import java.io.*;
class Err
{
public static void main(String[] args) throws Exception
{
PrintStream ps=new PrintStream(new
FileOutputStream("output.txt"));
System.setErr(ps);
System.setOut(ps);
System.out.println("fdffdfdffffff........");
}
}
| Is This Answer Correct ? | 8 Yes | 0 No |
Post New Answer View All Answers
What are the 4 types of research methods?
What is the difference between post and put?
Is a case study a method or methodology?
Is double bigger than float?
What is the benefit of using enum to declare a constant?
What are the advantages of assembly language?
What is the purpose of the enableevents() method?
Discuss about garbage collector in Java.
Explain numeric promotion?
What is time complexity algorithm?
Does java support Operator Overloading?
What is logical variable?
What type of variable is gender?
What is the difference between preemptive scheduling and time slicing in java programming?
What is hashing principle in java?