Thursday, November 17, 2011

Java knowhow - 1

Often I run into situations where I want to have multiple constructors which do pretty much the same things except that they call their own versions of the super class constructors. So, I end up creating a private initialization method that will be called from each of these constructors. Too annoying. The 'initialization blocks' will come in handy in these situations. This block of code is guaranteed to be copied to every constructor that you write. So, no more annoying private initialization methods. :)

No comments:

Post a Comment