• Post Reply Bookmark Topic Watch Topic
  • New Topic

Finally Block  RSS feed

 
Divya Kumar
Greenhorn
Posts: 16
Eclipse IDE IntelliJ IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Java code execute finally block in any case.
My question how compiler make byte code for those .java file who have finally block in the code.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What exactly do you want to know?

How finally works, is just part of how the Java programming language works. There are no special tricks that the compiler has to perform to make this work. It's just a feature of the JVM.
 
Anayonkar Shivalkar
Bartender
Posts: 1558
5
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
divya kumar wrote:Java code execute finally block in any case.

Not necessarily.
divya kumar wrote:My question how compiler make byte code for those .java file who have finally block in the code.

Well, from byte code perspective, I don't think why there should be any difference to java file with or without finally block. Its just another logical path. That's it.

I hope this helps.
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
divya kumar wrote:
Java code execute finally block in any case.


Well, any case where the thread survives long enough for the try statement to complete.

My question how compiler make byte code for those .java file who have finally block in the code.


Like this:

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!