Can I use methods of a class without instantiating this class?

前端 未结 11 2087
执念已碎
执念已碎 2020-12-15 04:10

I have a class with several methods and there is no constructor among these methods.

So, I am wondering if it is possible to call a method of a class without a creat

11条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-15 05:07

    It's called static variables and static methods. Just try it and see that it compiles.

提交回复
热议问题