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
v-model life cycle
What are the application of stack?
Is java a super set of javascript?
Write a program to show whether a graph is a tree or not using adjacency matrix.
Which class cannot be a subclass in java?
What is final int?
Can java inner class be static?
How can we make a class virtual?
What is difference between call by value and call by reference?
What is the string function?
What is threaded programming and when is it used? : Java thread
Explain java coding standards for constants?
Does every java program need a main?
When does a class need a virtual destructor?
What do you understand by private, protected and public?