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 is an inner class in java?

903


Explain the importance of thread scheduler in java?

951


Explain about narrowing conversion in java?

955


what is the messsage u r going to get from an objectoriented programing?

2047


Is list thread safe in java?

872


Will the compiler creates a default constructor if I have a parameterized constructor in the class?

1042


Explain the features of java?

965


Explain the JDB in depth & command line.

958


How many threads does a core java have?

996


What is array initialization in java?

985


What are the core java topics?

984


What is the purpose of the file class in java programming?

955


What is ellipsis in java?

1000


Can we override private method in java?

1043


Can we declare a class as static?

1036