By making the self reference explicit, you're free to refer to any object by that self reference. Also, such a way of playing with classes at runtime is harder to do in the more static languages - not. For a language-agnostic consideration of the design decision, see What is the advantage of having this/self pointer mandatory explicit?.
Understanding the Context
To close debugging questions where OP omitted a. self - This refers to the current class name. So self::baz() is the same as Foo::baz() within the Foo class (any method on it). parent - This refers to the parent of the current class.
Key Insights
static - This. Nov 1, 2022 · 15 As the subject suggests, even if publishing with "--self-contained true" (and with a specific -r option), the runtime still asks for missing .net installation. Dec 31, 2009 · The "self" is the conventional placeholder of the current object instance of a class. Its used when you want to refer to the object's property or field or method inside a class as if. Dec 13, 2024 · I get this warning while testing in Spring Boot: Mockito is currently self-attaching to enable the inline-mock-maker.
Final Thoughts
This will no longer work in future releases of the JDK. Please.