• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

few more questions

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • 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
  • 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 .
 
Paddy spent all of his days in the O'Furniture back yard with this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic