Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Write a program to calculate factorial in java?

1003


When will you define a method as static?

1095


What are classloaders?

1019


What is the advantage of preparedstatement over statement?

1109


Is singleton class thread safe?

996


What is the main use of java?

1169


What is class and object in java?

1005


What is the use of bufferedreader?

996


What do you understand by soft reference?

1056


Can you access non static variable in static context?

1045


What is t in generics in java?

1068


What is rmi and steps involved in developing an rmi object?

1065


What is difference between module and function?

1179


how to create multithreaded program? Explain different ways of using thread? When a thread is created and started, what is its initial state? : Java thread

1001


What is a static class in java?

1012