when debugging java code, in the stack trace, I noticed that something in the following
ToyotaCar(AbstractCar).handle() line: 40
It looks like the class in the brace is the base class. Will eclipse always show the base class?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you invoke a method of a base class, the stack line will show both the base class (where the method is defined) and the class of the object that invoked such method.
I assume here that you did something like
where
ToyotaCardoes not override thehandle()method. The stack trace notifies you that your call tohandle()is not served by the actualToyotaCar, but byAbstractCar. Yet, you invoked it on aToyotaCarobject.By itself, this notation for a stack line might seem excessive if you don’t override base class methods. Consider, however, the case where you want to override the
handle()method, but still need to callhandle()onAbstractCar. You will need to issue ainside
ToyotaCar.handle(). When calling thehandle()method on aToyotaCarobject, you will first call it as aToyotaCarand then as anAbstractCar. The two stack lines will unambiguously allow you to tell one call from the other.