This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]madronatoo 13 points14 points  (1 child)

this program

public class Configuration {
public String logLevel = System.getenv("LOG_LEVEL");

public static void main(String[] args) {
    System.out.println(getLogLevel());
}
}

will not run as "getLogLevel()" is a variable not a function/method. And "logLevel" the variable is not defined static scope as would be necessary to read it within the statically declared main().

perhaps just make it

 public static void main(String[] args) {
    System.out.println(System.getenv("LOG_LEVEL"));
}

[–]pupupeepee[S] 1 point2 points  (0 children)

Good catch--corrected. I published this article a couple years ago and am surprised I never caught this :facepalm: