So, I'm beginning to learn Java and I think it's an awesome programming language, however I've come across the static
keyword which, to my understanding, makes sure a given method or member variable is accessible through the class (e.g. MyClass.main()
) rather than solely through the object (MyObject.main()
). My question is, is it possible to make certain methods only accessible through the class and not through the object, so that MyClass.main()
would work, however MyObject.main()
would not? Whilst I'm not trying to achieve anything with this, I'd just like to know out of curiosity.
In my research I couldn't find this question being asked anywhere else, but if it is elsewhere I'd love to be pointed to it!
Forgive me if it's simple, however I've been thinking on this for a while and getting nowhere.
Thanks!