Answers for "error: java.lang.StackOverflowError"

0

java.lang.StackOverflowError

public class Vehicle {
    public void accelerate(float acceleration, float maxVelocity) {
        // set the acceleration
    }
}

public class SpaceShip extends Vehicle {
    @Override
    public void accelerate(float acceleration, float maxVelocity) {
        // update the flux capacitor and call super.accelerate
        // oops meant to call super.accelerate(acceleration, maxVelocity);
        // but accidentally wrote this instead. A StackOverflow is in our future.
        this.accelerate(acceleration, maxVelocity); 
    }
}
Posted by: Guest on February-25-2021

Code answers related to "error: java.lang.StackOverflowError"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language