In case of an inner class, what I learnt is that all modifiers except transient can be used, but when I used private or static modifiers in front of ordinary classes, compile error occured. Can someone tell me why?
Like Sam said, a private top level class would be useless. Something that is static has to be static in relation to something else. A variable or method is static in relation to the class that encloses them. That is to say- the variable or method is valid only at the enclosing class level. If you try to make the top level class static, what would it be static in relation to? Doesn't make sense. A nested class can be static in relation to the enclosing class (of course then it is no longer termed an "inner" class).
"JavaRanch, where the deer and the Certified play" - David O'Meara