Why isn't calling a static method by way of an instance an error for the Java compiler?

后端 未结 12 2209
北海茫月
北海茫月 2020-11-22 06:59

I\'m sure you all know the behaviour I mean - code such as:

Thread thread = new Thread();
int activeCount = thread.activeCount();

provokes

12条回答
  •  别那么骄傲
    2020-11-22 07:50

    Probably you can change it in your IDE (in Eclipse Preferences -> Java -> Compiler -> Errors/Warnings)

提交回复
热议问题