I have run the following code (JunkFirst.java)in eclipse to prove that only methods can be overriden. It is throwing runtime exception "stackoverflow". How do I correct the error?
posted 3 years ago
You have an infinite recursion. In your definition of the class Child, you have an instantiation of that class. That means that any time you try to instantiate a new Child, that instance will instantiate a new Child, and then that instance will instantiate a new Child, and so and so on until the stack runs out of space.