0
Method confusion
In the previous lessons, it was shown that a method could be called without creating an object. Now this is saying to create a new dog object in the Animal class to call dog.bark(). But can can't just call bark() as shown before? Thanks for the help!
4 Answers
+ 3
Method must be static to be called without instance.
+ 1
If method doesn't use any of its class non-static fields, then you should mark it static, otherwise it can't be static.
0
Oh thanks Zilvinas! Also, can you tell me when it is more beneficial to use static and when not to? Thanks a bunch!
0
solo usa un metodo Static() :v