Java: Self for calling static methods in one class

Is it possible to do something like this self::in PHP so as not to require the invocation of a class-type tro to invoke the static method in the same class. See how I do it:

public class Foo
 public static void blaa() {...}
 public void foobar
 {
    Foo.blaa();
 }

but I would like it to be like

public class Foo
 public static void blaa() {...}
 public void foobar
 {
    _SOME_SORT_OF_SELF_.blaa();
 }

no need to write the class name again and again ... The same goes for static attributes. Instead of using Foo.MY_ATTRit is possible to access it through _SOME_SORT_OF_SELF_.MY_ATTR.

Possible? Thanks

+4
source share
1 answer

static , , . ( ).

, , this .

+7

Source: https://habr.com/ru/post/1533814/


All Articles