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
  • 198,278
  • 20
  • 158
  • 249
curious1
  • 14,155
  • 37
  • 130
  • 231

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
  • 198,278
  • 20
  • 158
  • 249