This code shows error at run time:
class Animal { Animal object1 = new Animal(); public static void main(String[] args) { Animal obj =
It's a stack overflow.
It's similar to calling a function from the same function, like this:
void func(){ func(); }
It will repeat until the stack fills, and then the program will crash.
Cheers.