aspose file tools*
The moose likes Java in General and the fly likes override with runtime exception required to provide exception handling?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "override with runtime exception required to provide exception handling??" Watch "override with runtime exception required to provide exception handling??" New topic
Author

override with runtime exception required to provide exception handling??

Kaustubh G Sharma
Ranch Hand

Joined: May 13, 2010
Posts: 1277

HELP



No Kaustubh No Fun, Know Kaustubh Know Fun..
Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 2318
    
  49
That won't compile for a host of reasons and your question makes no sense because Class1 and Class2 don't have a method called run(), did you mean test()?

Assuming you do mean test(), what makes you think the second line would need wrapping in a try-catch statement?
Kaustubh G Sharma
Ranch Hand

Joined: May 13, 2010
Posts: 1277

Tony Docherty wrote:

Assuming you do mean test(), what makes you think the second line would need wrapping in a try-catch statement?


Hey Tony, Good evening. Yes I do mean from test() method only. as override test() throws ClassCastException which is an unchecked exception, still it required to be call with try--catch block, well my eclipse say so.. I am not sure about this. Is there any relation which bound override method to be called with try---catch block??
Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 2318
    
  49
Please provide an SSCCE so we can see exactly what your problem is.
Kaustubh G Sharma
Ranch Hand

Joined: May 13, 2010
Posts: 1277

Hi Tony, as you can see in above example, in overriden method we're using runtime exception which is not required exception handling logic, then for what reason jdk showing me runtime exception when I am calling Class2's test method? all I wants to know what is the relationship between these method which bound them so that you need to provide exception handling for runtime exception also???
Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 2318
    
  49
Kaustubh G Sharma wrote:Hi Tony, as you can see in above example,

Unfortunately I can't see anything from the above example because it isn't valid Java and it doesn't show the problem you are experiencing. And even if I change to legal Java it still doesn't show the problem ie it compiles without any problems.
Post a short compilable example which shows the problem and I'll look at it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: override with runtime exception required to provide exception handling??