Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Statement not reachable??

 
srikanth reddy
Ranch Hand
Posts: 252
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


here why there is no error that statement is not reachable ...since the control returns out of main method??? c is not printed ..so why there isn't any error??
 
Srinivasa Raghavan
Ranch Hand
Posts: 1228
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try to put the return statement before the try catch block.. then you 'll get the error. When there is an exception ( checked or Unchecked ) thrown inside the try block then catch gets executed after that the S.O.P line will be rechable
[ October 14, 2005: Message edited by: Srinivasa Raghavan ]
 
Liang Tong
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"return" means "terminate"
if there's no finally block in the structure "try-catch-finally"
the "return" in try block means "this method is over"
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic