This question already has an answer here:
From what I have read: The reason is because it is not easy to determine which method will actually be called as we have inheritance.
However, why doesn't Java at least have tail-recursion optimization for static methods and enforce proper way to call static methods with the compiler? Why Java has no support at all for tail-recursion.
I am not sure if there is any difficulty here at all.
[A few people marked this one as duplicate even when the author of the other one has come and said it is not a duplicate. The two questions are clearly different.]
Aucun commentaire:
Enregistrer un commentaire