This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exception Handling

 
Ramesh Pramuditha Rathnayake
Ranch Hand
Posts: 178
2
Java MySQL Database Netbeans IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Why line 9 gives compile error while line 5 is being compiled..?
(This error occurs in JDK 1.7 only!)
 
Stephan van Hulst
Bartender
Pie
Posts: 4829
34
Chrome Netbeans IDE Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The compiler reasons that the only type of Exception that you can catch in your catch-block is a runtime exception, which you may always rethrow without having to declare it.

Change the empty comment line to throw a non-runtime exception and you will see that the compiler will complain the same way for line 5.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic