Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 static option is shown as disabled. Why is that?

like image 701
Saikat Avatar asked Aug 30 '26 09:08

Saikat


1 Answers

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.

like image 60
Mureinik Avatar answered Sep 02 '26 06:09

Mureinik



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!