is this possible? I have a listener class that implements ActionListener. In this class, I implement the actionPerformed method. I will attach the listener class to a button, so whenever I click on the button, the actionPerformed method will be invoked. Now, in this method, there will be code that will throw exceptions (possibly maybe reading a file, IOException) But actionPerformed signature does not allow it to throw exceptions. The compiler keeps on complaining. How do I solve this problem?
But actionPerformed signature does not allow it to throw exceptions.
You don't have much of a choice. You must catch your exceptions inside a try catch block and handle everything there since you cannot rethrow the exception. -anthony [ March 29, 2002: Message edited by: Anthony Villanueva ]