Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within OCPJP
Search Coderanch
Advance search
Google search
Register / Login
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
Tim Cooke
Ron McLeod
paul wheaton
Jeanne Boyarsky
Sheriffs:
Paul Clapham
Devaka Cooray
Saloon Keepers:
Tim Holloway
Roland Mueller
Himai Minh
Bartenders:
Forum:
Programmer Certification (OCPJP)
problem with catch and finally
Angela lewis
Ranch Hand
Posts: 100
posted 20 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
public class Mine { public static void main(String argv[]){ Mine m=new Mine(); System.out.println(m.amethod()); } public int amethod() { try { FileInputStream dis=new FileInputStream("Hello.txt"); } catch (FileNotFoundException fne) { System.out.println("No such file found"); return -1; } catch(IOException ioe) { } finally{ System.out.println("Doing finally"); } return 0; } }
If Hello.txt does not exist then the output would be
No such file found
Doing finally
-1
Why isn't it
No such file found
Doing finally
-1
Thanks
Swamy Nathan
Ranch Hand
Posts: 187
posted 20 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Something seems to be wrong with the question (I think)?
Looluo Zhu
Greenhorn
Posts: 8
posted 20 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I think the question should be
No such file found
Doing finally
0
Why isn't it
No such file found
Doing finally
-1
and
this thread
has the answer.
SCJP 1.4
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
?
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Exceptions
exCeption
try catch block
Doubt regarding FileInputStream
static methods
More...