This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi Its simple, can't invoke a inner class constructor unless its not defined. For every class you define a .class file is created by the Java compiler. So when you call the constructor of 'first' class the corresponding can't be found. Its like using a undefined variable.
Joined: Sep 09, 2004
Thank you for your reply. "can't invoke a inner class constructor unless its not defined" "when you call the constructor of 'first' class the corresponding can't be found."
- Inner class is defined in outer class tst. If you run code as it is, it will compile fine. - So there is no proble of definition of innerclass and it's constructor (which is default).
Remember that while instance and class identifiers are in scope throughout the class definition, local method identifiers are only in scope from the point of definition to the end of the method (here I ignore hiding and overriding).
class first is not in scope at line 1 but is in scope at line 2.