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

v-model life cycle

2035


What are the application of stack?

911


Is java a super set of javascript?

1096


Write a program to show whether a graph is a tree or not using adjacency matrix.

1088


Which class cannot be a subclass in java?

1012


What is final int?

1015


Can java inner class be static?

1013


How can we make a class virtual?

1108


What is difference between call by value and call by reference?

992


What is the string function?

950


What is threaded programming and when is it used? : Java thread

1059


Explain java coding standards for constants?

1006


Does every java program need a main?

988


When does a class need a virtual destructor?

1006


What do you understand by private, protected and public?

1037