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

What is parsing in grammar?

1087


Is void a type?

1026


What is a jagged array in java?

1172


What is rule of accessibility in java?

1076


What is the difference between dom and sax parser in java?

1025


What is the program compilation process?

1186


Explain tree set and its features?

1112


Is it compulsory for a try block to be followed by a catch block in java for exception handling?

1055


What is a class in java?

1058


Explain about wait() method?

1075


hr interview how many minutes asking question

2090


Explain about data types?

1147


Explain, java is compatible with all servers but not all browsers?

1105


Which software is used for java programming?

1081


Can I declare a class as private?

1124