This week's book giveaway is in the Raspberry Pi forum.
We're giving away four copies of Getting started with Java on the Raspberry Pi and have Frank DelPorte on-line!
See this thread for details.
Win a copy of Getting started with Java on the Raspberry Pi this week in the Raspberry Pi forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Liutauras Vilda
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Piet Souris

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

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Paddy spent all of his days in the O'Furniture back yard with this tiny ad:
Low Tech Laboratory
https://www.kickstarter.com/projects/paulwheaton/low-tech-0
reply
    Bookmark Topic Watch Topic
  • New Topic