My thoughts as an enterprise Java developer.

Wednesday, April 06, 2005

Anonymous class constructor

Today I was trying to modify an anonymous class to add a parameter to the constructor. After talking to 3 other co-workers we couldn't decide if it was possible because a constructor has to be named to match the name of the class and an anonymous class does not have a name. I found the answer at http://www.developer.com/java/other/article.php/3300881 under the section titled "Anonymous classes versus local classes." I am not including the answer here so that you can think about it for a while if you desire.

No comments: