JAVA : Accessing static method properly

后端 未结 5 1133
既然无缘
既然无缘 2021-01-05 02:40

I am new to JAVA, and I like to try and understand everything.

When accessing a static method \"hero.returnHp()\" in JAVA, I have the following:

 he         


        
5条回答
  •  失恋的感觉
    2021-01-05 03:32

    1. It is part of the JVM spec.
    2. You don't need to. A static method is common between instances of a class, your confusion arises from thinking it is an instance method.

提交回复
热议问题