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 the different types of functions?

1098


How do you create a bulleted list?

1306


What happens if a try-catch-finally statement does not have a catch clause to handle an exception that is thrown within the body of the try statement?

1173


Explain the features of interfaces in java?

1031


What is locale?

1083


Class c implements interface I containing method m1 and m2 declarations. Class c has provided implementation for method m2. Can I create an object of class c?

1686


How do you create an array in java?

1033


What is the difference between a loader and a compiler?

1087


What if I write static public void instead of public static void in java?

1136


What do you mean by object?

1032


What are nested classes in java?

1168


What is the program compilation process?

1186


What is the scope or life time of instance variables?

1162


How do you find the independent variable?

1124


How does thread synchronization occurs inside a monitor? What levels of synchronization can you apply?

1009