This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
Depends on where you are trying to create an instance of the inner class. Here are two examples to show my point. In the first examle, I create the OuterClass and have a main method of the OuterClass that I run.
In this case all three methods work. For the second example, I have a new class that tries to create an instance of the inner class.
In this case, method 2 will fail since you can no longer referce variables of the class without an instance of the class, so you can't say InnerClass becuase it doesn't know what InnerClass is unless you say o.InnerClass. So 1 and 3 are always correct and 2 may or may not be correct. Bill
Joined: Nov 02, 2000
thanks a lot Bill, that was just brilliant!
subject: Are the following the ONLY ways to instantiate a non static inner class