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 / biru3121

The class System has a variable out that represents the
standard output, and the variable err that represents the
standard error device. By default, they both point at the
system console. This how the standard output could be re-
directed:

Stream st = new Stream(new FileOutputStream("output.txt"));
System.setErr(st);
System.setOut(st);

Is This Answer Correct ?    6 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the advantages of arraylist over arrays?

1092


What is treemap in java?

947


a thread is runnable, how does that work? : Java thread

1015


Why should I use abstract class?

1105


What are format specifiers in java?

1064


Which package is always imported by default?

1101


Write a program in java to create a doubly linked list containing n nodes.

972


What is the largest long allowed by java?

1066


How is it possible in java programming for two string objects with identical values not to be equal under the == operator?

1026


Explain the difference between serializable and externalizable in java?

1066


How many types of voids are there?

992


Why do we declare a class static?

1155


What is xslt in java?

979


What is initial size of arraylist in java?

1058


What is the generic class?

971