Can somebody please tell me why I get the compile error saying that EOFException is not found in class exception_test when I have imported Throwable ??? I know this code doesn't make any sense, but I'm just trying to test throwing exceptions..
All exception classes are subtypes of class Exception. This class derives from the class Throwable (which derives from the class Object). Hence, there are two subclasses that derive from Throwable: Exception and Error. Thus, all the exceptions that are thrown will be somewhere in this Throwable hierarchy.
Originally posted by Maduranga Liyanage: Hi Lalitha..
It worked.. Thanks a lot!!! But isn't every exception that can be thrown is under Throwable??
Are you confusing extending a class with using a class by importing the appropriate package ? If you do not import the required Exception class, the compiler cannot locate it. This is in no way related to the class you have imported even though it happens to be the super class. It's a different case when it comes to using try-catch construct. If you use Exception class in catch, it will catch any exception that is derived from Exception.
Originally posted by Maduranga Liyanage: Can somebody please tell me why I get the compile error saying that EOFException is not found in class exception_test when I have imported Throwable ??? I know this code doesn't make any sense, but I'm just trying to test throwing exceptions..
[ June 02, 2005: Message edited by: Barry Gaunt ]
what should be import to make this class run..??
is we have to import exceptions every time we use them ?
i think java.util.* is included in every program by default but does that means that only clases comming under java.util will be implicitly accessable ??/
Thanks and Regards, Amit Taneja
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com