• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

few more questions

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
public class ExceptionTest{
public static void main(String args[]) throws Exception{
try
{
m2();
}
finally { m3();}
}
public static void m2() throws NewException
{
throw new NewException();
}

public static void m3() throws AnotherException
{
throw new AnotherException();
}
}
The answer says it will compile fine and throw AnotherException when
run. But will it not throw both the excptions?
 
Ranch Hand
Posts: 290
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It will throw both the exception's but an execption generated in the finally block override's any previously unhandled exception therefore only the last execption generated is shown .
reply
    Bookmark Topic Watch Topic
  • New Topic