wood burning stoves*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Traps to be aware of in any SCJP test !!!!! :) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Traps to be aware of in any SCJP test !!!!! :)" Watch "Traps to be aware of in any SCJP test !!!!! :)" New topic
Author

Traps to be aware of in any SCJP test !!!!! :)

Jeff L.
Greenhorn

Joined: Sep 02, 2003
Posts: 8
Why are static inner classes referred to sometimes as nested top-level classes? I think it is just silly semantics. Someone probably, realized once that the below two code fragments would have exactly the same implementation if you pretend that the latter is a legal name. I can see the reasoning now: "Since in the implementation of an inner static class, the binary code doesn't need a pointer to an instance of the outer class, maybe we shouldn't call an inner static class inner at all, but rather nested top-level."
Fortunately, wiser heads prevailed and they mostly abandoned the semantic quibble, rather than pushing a confusing, yet meaningless to non-language-implementers, distinction.
below:
class outer {
static class inner {
}}
class outer {}
static class outer.inner {}
Jeff L.
Greenhorn

Joined: Sep 02, 2003
Posts: 8
Oops again.
Final local variables cannot be initialized once, so from the perspective of local variables, what I said was true.
Final member variables behave differently. You can't initialize them on first use, but what you can do is initialize them in each constructor, rather than initializing them inline. Therefore I misspoke when I said the initialization had to be during declaration.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Traps to be aware of in any SCJP test !!!!! :)
 
Similar Threads
Finding it hard to fins something in the API ??
Eclipse plugin to debug web based application ?
Multiple interfaces
Free Mock test
Thanx