0

I have a class as follows:

public class MyClass {
   ...
   String lang = Config.getLang();
   ...
}

Config.getLang() is a public static method in class named Config. My question is: Does this initialization have any implication or problem?

String lang = Config.getLang();

Eclipse does not report any compilation problem.

Elliott Frisch
  • 191,680
  • 20
  • 149
  • 239
curious1
  • 13,281
  • 34
  • 116
  • 211

1 Answers1

4

As posted and described (and in general) it's perfectly valid to initialize a field by calling a static method (even if that method is in another class).

Elliott Frisch
  • 191,680
  • 20
  • 149
  • 239