Timeline for Calling static method from instance of class
Current License: CC BY-SA 4.0
6 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Sep 30, 2021 at 14:13 | comment | added | candied_orange | @user102008 that's not a fun fact.. That's an invitation to abuse maintenance programmers. | |
| Sep 29, 2021 at 17:16 | history | edited | amon | CC BY-SA 4.0 | removed confusing and possibly incorrect code example |
| Oct 28, 2014 at 15:22 | comment | added | user22815 | Java fun fact: ((MyClass) null).staticMethod() works and does not cause an NPE. It is equivalent to MyClass.staticMethod(). The object reference is never resolved when using it to call a static method, only its variable type is used. | |
| Oct 6, 2014 at 20:21 | comment | added | user102008 | [[instance class] staticMethod] does not resolve the method based on the static type of instance, but based on the dynamic class of the object pointed to by instance, so it is not like calling a static method on an instance in Java | |
| May 17, 2014 at 9:25 | vote | accept | CRDave | ||
| May 17, 2014 at 8:41 | history | answered | amon | CC BY-SA 3.0 |