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.
The only class you can declare static is a member class... And this member class can be instantiated only in the context of the class which the member belongs to. If you want to avoid this , you can declare the member class as static and you can use this class the same way as you do the top level (to which the member class belongs) class.. i.e the member class becomes a nested top level class..
Joined: Apr 15, 2005
I want to know why the super class cannot be static at all...Can u pls give me an answer for this question..
You want to know why a top-level class can't be static? OK, I'll tell you -- but first you have to explain to me what that would mean. What would "public static class" mean, exactly, and how would it be different from "public class", for a top-level class?