File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes need guidance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "need guidance" Watch "need guidance" New topic
Author

need guidance

Rajesh k Jha
Ranch Hand

Joined: May 10, 2009
Posts: 72


The result of this programme is compilation fail..What i guess is if we are sure that in the try block if it is 100% surity that exception will be thrown as we can see in the line 1, then there should not be any line below that? Please guide me if i wrongly understood the concept?
Samrat Som
Ranch Hand

Joined: Feb 04, 2009
Posts: 40
yep rakesh you are correct . As the Code is unreachable. You will get an Compilation error saying Unreachable Code.


SCJP 1.6
SCWCD 1.5 (Preparing...)
Nitish Bangera
Ranch Hand

Joined: Jul 15, 2009
Posts: 537

the surity is given by the throw keyword. If it were a risky statement then probably this won't be a correct answer. Also other part is if you are catching a checked exception means your try block should have a statement which threatens to throw a checked exception. If not then there will be compiler error again.


[ SCJP 6.0 - 90% ] , JSP, Servlets and Learning EJB.
Try out the programs using a TextEditor. Textpad - Java 6 api
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

The following page explains how to use code tags: http://faq.javaranch.com/java/UseCodeTags

In particular: write "code" with a small c, don't write [Code]. Note that above the editing window, there is a button named "Code" that you can click to start or end a code block.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: need guidance
 
Similar Threads
examlab(question-53)-unreachable statement NAO?
Exception Doubt
Doubt
Required more explantion on exmaple given in Thread.
throws Exception