You are not logged in.

#1 2015-06-15 06:42:23

husnain
User RankUser RankUser RankUser RankUser RankUser Rank
Administrator
From: Chichawatni,Pakistan
Registered: 2014-10-03
Posts: 8,129
Website

Prints out: Finally:

Java Quizzes Java Language Exceptions

Directions:
public class Test{
      public void divide(int a, int b){
            try{
              int c = a / b;
           }catch(Exception e){
              System.out.print("Exception ");
          }finally{
              System.out.println("Finally");
      }

      public static void main(String args[]){
            Test t = new Test();
            t.divide(0,3);
      }
}

Question:
What will be the result of executing the following code?

Option A):
Prints out: Exception Finally
Option B):
Compile with error
Option C):
Prints out: Exception
Option D):
Prints out: Finally

Correct Answer is Option D):
Prints out: Finally


You cannot discover the new oceans unless you have the courage to lose the sight of the shore.

2015-06-15 06:42:23

Advertisement
Ads By Google

Re: Prints out: Finally:



\n

Board footer