My question is related to another question: How does creating a instance of class inside of the class itself works?
I created two classes as follows:
class Test {
  Test buggy = new Test();
  public static void main (String[] args) {
    Test test = new Test();
    System.out.println("Done");
  }
}
And another:
class Test {
  static Test buggy = new Test();
  public static void main (String[] args) {
    Test test = new Test();
    System.out.println("Done");
  }
}
I do not understand why the first code (without static variable) gave the stack-overflow error but when I declare the instance variable to be static (the second case) I got no error. What difference does the static keyword makes here?