php hit counter

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Why we are passing IndexOutOfBoundsException ex in catch?we have not ex.any Method or
VU Help • House Banner VU Help Virtual University Students - Assignments, Solved Papers, GDB & Exam Help Student Help Forum • Collaborative • Free Support
#2
Each catch block is an exception handler and handles the type of exception indicated by its argument. The argument type, ExceptionType, declares the type of exception that the handler can handle and must be the name of a class that inherits from the Throwable class. The handler can refer to the exception with name.



In this code we are handling IndexOutOf BoundsException , Although we are not using any method of this but as it is required by catch so we are passing this argument.



You can use ex to display details of the exception like



catch(IndexOutOf BoundsException ex){
System.out.println(“you forget the passing parameters”Wink;

System.out.println(ex.getMessage());


}



In simple words we have to pass this argument as this is the requirement, this argument will tell compiler that what type of exception that will handle.

0300-9520262
Get solution in 24 hour
|cpmputer & internetConfusedmileys81:[SIZE="4"][SIZE="3"]....[/SIZE][/SIZE]
Reply


Messages In This Thread
Why we are passing IndexOutOfBoundsException ex in catch?we have not ex.any Method or - by Vuhelper - 04-24-2011, 09:33 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  what is the difference between Static method and the method we write in Clas saneha 1 4,820 04-28-2011, 09:12 PM
Last Post: Vuhelper
  Why getCountStudent() method is called using Class Name instead of first making new saneha 1 5,958 04-28-2011, 09:10 PM
Last Post: Vuhelper
  flush method in java 2011 saneha 1 2,986 04-24-2011, 09:49 PM
Last Post: Vuhelper
  try, catch and finally block? saneha 0 2,042 04-24-2011, 07:26 PM
Last Post: saneha

Forum Jump:


Users browsing this thread: 1 Guest(s)
VU Help • House Banner VU Help Virtual University Students - Assignments, Solved Papers, GDB & Exam Help Student Help Forum • Collaborative • Free Support