Saturday, July 31, 2010

Question 1:

what will be the out put of the below method in case of Exception and No Exception?

public int  someMethod(int a )throws Exception
{

     try
    {
           // Some Code
          if(a==0)
          throw new SomeException();
         return 1;
     }
     catch(Exception e)
      {
          return 2;
       }
       finally
      {
         return 3;
      }
}

Sol- It always return 3;

java first Hello

public class HelloWorld
{
 public static void main(String args[])
  {
          System.out.println("Welcome to Krish Unviverse Java World");
  }
}