• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java exceptions

 
Adi Sharma
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I came across the following:

void doStuff()
{
doMore();
}
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
author
Marshal
Pie
Posts: 21221
81
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Henry
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic