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 do you understand by weak reference?

1005


Is static a keyword in java?

977


Name few java.lang classes introduced with java 8 ?

981


What is the old name of java?

988


What is static keyword in java?

999


What is member in java?

1008


What is a finally block? Is there a case when finally will not execute?

1065


What is the difference between compiler and jvm?

1047


How many boolean functions are there?

956


What is difference between checked and unchecked exception in java?

1017


Implement a stack with push (), pop() and min() in O(1) time.

1104


What does @param args mean in java?

1053


How does remove work in java?

966


What are constructors in java?

1100


What is the point of java?

1017