Skip to content

Instantly share code, notes, and snippets.

@nhojpatrick
Created September 11, 2018 19:11
Show Gist options
  • Save nhojpatrick/f5c3f7c3e1234eaa36362fb40ac2560f to your computer and use it in GitHub Desktop.
Save nhojpatrick/f5c3f7c3e1234eaa36362fb40ac2560f to your computer and use it in GitHub Desktop.
A Bad Hello World example using static and public references of objects.
public class Parent {
public static final Level1 l1 = new Level1();
public static class Level1 {
public final Level2 l2 = new Level2();
}
public static class Level2 {
public final String helloWorld = "Hello World";
}
public static void main(final String[] args) {
System.out.println(Parent.l1.l2.helloWorld);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment