Monday, November 20, 2006

Java infrequently answered questions

Peter Norvig has an excellent list of Java related IAQ's (Infrequently Answered Questions) on his website. He talks about stuff that cover various subtleties in Java. Here's an example:

Q:Within a method m in a class C, isn't this.getClass() always C?

No. It's possible that for some object x that is an instance of some subclass C1 of C either there is no C1.m() method, or some method on x called super.m(). In either case, this.getClass() is C1, not C within the body of C.m(). If C is final, then you're ok.

-- Peter Norvig

 




Free Web Based Courses On Java Programming Best Practices and Obect Technology and Design 

No comments: