• 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
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

What happens after the finally {...} block is called?

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I cleared the SCJP exam today but I have seen two to three questions that address that concept. I realized I don't know whether the program exits or continue execution after the finally block. I guessed that the program will exit gracefully.

The other confusing topic was about the index used in the String.substring(), replace(), delete() methods. I thought it was absolutely ridiculous for JavaSE team to define the method with a zero-based starting indicee and a 1-based ending indicee (if this is true, please do correct me if wrong). During the exam, I was doing this index counting question and I realize I don't know how to count index of a simple "123456789" string anymore!

I feel like an idiot doing this index counting. Why cann't Sun make everything 0-based? Anyway, this is simply dumb. I am sorry if I offend anyone but I have to say this again, because it is really, really dumb to make people work two different index-base in a single method and expect them to not be confused.

Clear the exam but still mad because I thought I would have done better.





 
Bartender
Posts: 4109
72
Hibernate Fedora Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim-Ting Chang wrote:I realized I don't know whether the program exits or continue execution after the finally block. I guessed that the program will exit gracefully. ....


That may depend on how the code looks. If say, a runtime exception is thrown which is not caught/declared then after the finally it will exit.
 
Ranch Hand
Posts: 808
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim-Ting Chang wrote:
I thought it was absolutely ridiculous for JavaSE team to define the method with a zero-based starting indicee and a 1-based ending indicee (if this is true, please do correct me if wrong).


Unfortunatelly, You are wrong. With 0-based first argument and 1-based the second one - you can simply calculate a substring's length: end - start
 
Sheriff
Posts: 9697
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you use this technique



then these type of questions become damn easy. The zero based first argument and one based second argument thing is a piece of cake with this...
 
I found some pretty shells, some sea glass and this lovely tiny ad:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic