Home Tutorial Java Scjp Part6 SCJP Module-6 Question-7

 
 

Share on Google+Share on Google+
SCJP Module-6 Question-7
Posted on: July 14, 2010 at 12:00 AM
Advertisement
The example given below will test your knowledge of try, catch, and finally key word and also helps you for the preparation of SCJP exam.

Given below the sample code :

public class section66 {
public static void main(String[] args) {
  System.out.println("Inside try");
  catch{
  System.out.println("Inside catch");
  }
  finally {
  System.out.println("Inside finally ");
  }
  System.out.println("at end of the code");
  }}

Find the error in the above code ?

1. No errors. Prints :  Inside try
                                 Inside finally
                                 at end of the code

2. Prints : "Inside try".

3. Prints : "Inside finally".

4. Compile error 'catch' without 'try'

Answer :

(4)

Advertisement

Related Tags for SCJP Module-6 Question-7:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: July 14, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com