Share on Google+Share on Google+

SCJP Module-6 Question-26

The Sample program given below will check your understanding about the Exception in Java programming language.

Given below the sample code :

static void check() throws RuntimeException {
try {
System.out.print("checking ");
throw new RuntimeException();
catch (Exception ex) { System.out.print("runtime"); }
public static void main(String[] args) {
try { check(); }
catch (RuntimeException ex) { System.out.print("exception"); }

What will be the output of the above code ?

1. Compile error

2. checking runtime success

3. checking runtime exception success

4. checking success




Posted on: July 15, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial 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.


Advertisement null