Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
"I'm not back." - Bill Harding, Twister
"I'm not back." - Bill Harding, Twister
I know that they both gets translated into top level classes. one will be Bar another will be Foo$Bar
when i extend the Foo class it happens if i don't extend Foo it doesn't happen. I still can't see where the jls says that.
It will be compiled to Foo$Bar.class when Bar is an inner class of Foo. It will be compiled to Bar.class if Bar is not an inner class. I don't think whether or not it extends foo has anything to do with it. Everything else you said is correct.
Originally posted by simon valter:
yes, but when you have both, then it will matter, try it yourself. when you extend you get a instance of the Foo$Bar class when you don't extend you get a instance of the Bar class
"I'm not back." - Bill Harding, Twister
"I'm not back." - Bill Harding, Twister
However there are a few people still using nested and inner as interchangeable. At least until we finish rounding them up for the reeducation camps.
"I'm not back." - Bill Harding, Twister
Hug your destiny! And hug this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|