Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

finally

 
Val Lee
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Answer is E.I don't know why E is right.
 
Basant K Sahu
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried to compile the code and came out with two errors for line 13.
Error 1:Variable out may not have been initialized. The variable out is declared before the try block but is not initialised. It gets initialised only in the try block.
I modified the code to
to avoid this error.
Error 2: IOException must be caught or declared for out.close();
Error 2 looks self explanatory.
[ July 13, 2002: Message edited by: Basant K Sahu ]
 
zarina mohammad
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to catch the Exception occuring in the finally block? Having a catch block after the finally block results in error.
how to get around with this error?
 
Dan Chisholm
Ranch Hand
Posts: 1865
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by zarina mohammad:
How to catch the Exception occuring in the finally block? Having a catch block after the finally block results in error.
how to get around with this error?

You can nest a try/catch block inside the finally block.
 
Val Lee
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thx.I understand!
 
Chung Huang
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or, a lazy way would be throw the error up the chain.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic