I’m told that this is one way of calling a method:
If you write just the name of the method or property, Java will make a guess as to what you were meaning to write before the name, based on the following rules
- If the method is NOT static, it will try to find a non-static method/property with the name, then look for a static method/property
- If the method IS static, it will try to find a static method/property only
Could anyone give me an example of this? I’m having trouble understanding what it means, since how could it know whether the method is static or not before it finds the method, but it finds the method based on whether its non static or static? Or are there two different methods they’re referring to or something?
Here is an example with appropriate comments of what would happen in the methods c, d and e: