posted 17 years ago
Hi KrishnaKumar.
Further to what Keith said,
I think question one also involves "implicit import" of java.lang.* library. I read somewhere that this happens, but I dunno much about it.
Note that Exception and other exceptions such as SecurityException, ArithmeticException are in the library and do not need any additional import declaration. See API.
If you want to use IOException, you have to import java.io and you also have to put some code in try block that will possibly throw IOException eg
FileReader fr = new FileReader("someFileName.txt");
As for Question 2, only Throwable and subclass can be caught (Keith) and while an exception is an object an object is not an exception.
[ March 29, 2005: Message edited by: Jeff Tian ]
The magic of believing in yourself is to risk all that you have for a dream <br />that nobody sees but you. (Million Dollar Baby)<br /> <br />SCJP 1.4