What is wrong with following program

0 views
Skip to first unread message

Rohit Ghatol

unread,
Dec 18, 2007, 1:16:21 PM12/18/07
to Pune Java Puzzles
Could you find out what is wrong with following program?
Also once you find out, what would be the fix?

public class Logger{

public void log(String message) throws IOException{
try{
FileOutputStream log1Stream=.........
FileOutputStream log2Stream=.........

log1Stream.write(......);
log2Stream.write(......);
}
finally{
if(log1Stream!=null){
log1Stream.close();
}
if(log2Stream!=null){
log2Stream.close();
}
}
}
}

Rohit Ghatol

unread,
Dec 18, 2007, 2:10:20 PM12/18/07
to Pune Java Puzzles
Let me correct a simple typo error first then you all can start on
this problem

public class Logger{

public void log(String message) throws IOException{
FileOutputStream log1Stream=.........
FileOutputStream log2Stream=.........
try{
Reply all
Reply to author
Forward
0 new messages