This week's book giveaway is in the JavaFX forum.
We're giving away four copies of Introducing JavaFX 8 Programming and have Herbert Schildt on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes java exceptions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "java exceptions" Watch "java exceptions" New topic

java exceptions

Adi Sharma
Ranch Hand

Joined: May 18, 2009
Posts: 33

I came across the following:

void doStuff()
void doMore() throws IOEXception
throw new IOException();

In this code the method doStuff() does not declares nor does it handles the IOException thrown by doMore() function. If doStuff() also declares a IOException and does not handles the exception using a try catch block, the method that is further down in the call stack should handle it. What if the last method in the call stack also does not handles it. Will it be a compile time error?
Henry Wong

Joined: Sep 28, 2004
Posts: 20133

Will it be a compile time error?

It is not too hard to write a test program -- to compile. Give it a test, and let us know the results.


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Consider Paul's rocket mass heater.
subject: java exceptions
It's not a secret anymore!