Before changing anything in the given code . i would like to know the cause of having a stack over flow .
What I already know is : Having stackOverFlow error means that the the amount of stack space required by the program exceeds what is configured for the stack in the Java virtual machine . But here i see none of the see. I don't see an unending loop or something like that !
package de.codegym.task.task15.task1528;
/*
OOP: Der Euro ist auch Geld
*/
public class Solution {
public static void main(String[] args) {
System.out.println(new Euro().getAmount());
}
public static abstract class Money {
abstract Money getMoney();
public Object getAmount() {
return getMoney().getAmount();
}
}
// Code unten einfügen
public static class Euro extends Money {
private double amount = 123d;
public Euro getMoney() {
return this;
}
}
}