• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

warning in finally

 
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

the above is giving this error
warning: finally clause cannot complete normally
}
^
1 warning
can any1 plz explain this
(Adding code tags - which I just love doing)
[ April 20, 2004: Message edited by: Barry Gaunt ]
 
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
its just a warning not an error, the code compiles
If your question IS WHY DOES IT GIVE A WARNING ?
I,ll try a long shot here:
the finally block must comlplete before the method retruns. The compiler sees a return which means abnormal completion, so it barks a warning.
If some stement was after the return it would give a compile error
 
pallavi utukuri
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
abnormal completion due to return in finally or try
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Whats your version of JDK? I have no warnings popping up when I compiled Fry.java and TooHotException.java.
 
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I too do not get any warnings...
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
With Java HotSpot(TM) Client VM (build 1.4.1_02-b06, mixed mode) there are this warning of Pallavi, wich is your compiler K and Kaustubh?.
Pallavi, your abnormal completion is due a finally in the method start, it's a first code block in execution and the finally 'almost' always execute
 
reply
    Bookmark Topic Watch Topic
  • New Topic