04-24-2011, 09:32 PM
Here in code
catch(IndexOutOf BoundsException ex){
System.out.println(“you forget the passing parameters”);
}
we have method catch having the parameter of class IndexOutOfBoundsException ex, here ex is an identifier (or instance of the object)of IndexOutOfBoundsException.
Every object of class has Private ,public, protected parts which can be access public or protected parts with the help of identifier like ex, but in the above method, we are not using the ex to access the any part of object or instance of the class IndexOutOfBoundsException.like ex . anyMethod(getter or setter or other method of the class)
Then if I donot use ex to access any part with help of “.” , then why passing temporary object as a parameter? Why we need it ? where its role in the code?
catch(IndexOutOf BoundsException ex){
System.out.println(“you forget the passing parameters”);
}
we have method catch having the parameter of class IndexOutOfBoundsException ex, here ex is an identifier (or instance of the object)of IndexOutOfBoundsException.
Every object of class has Private ,public, protected parts which can be access public or protected parts with the help of identifier like ex, but in the above method, we are not using the ex to access the any part of object or instance of the class IndexOutOfBoundsException.like ex . anyMethod(getter or setter or other method of the class)
Then if I donot use ex to access any part with help of “.” , then why passing temporary object as a parameter? Why we need it ? where its role in the code?

;
mileys81: