Saik0 Saik0 - 5 months ago 33
Java Question

Static option is disabled while creating a new Java class in Eclipse

When I try to create a new Java class in Eclipse, under the "Modifiers" section

option is shown as disabled. Why is that?


The static modifier means a member (be it a field, a method or an inner class) belongs to the class instead of to a specific instance of it. A top level class does not belong to anything (it is not within another class), and thus cannot be static. Only an inner class can be static.