Ankit is correct. Also note that this is not different from the usual rule that says that you can't call an instance method from a static context. Although super is not a method (it is a keyword,) if you are going to call an instance method of the superclass via super, you have to do it in an instance context.
Additionally, both these syntaxes are correct: super.<methodName>(); <ClassName>.super.<methodName>();
Again, this only works from within an instance method. [ December 31, 2008: Message edited by: Ruben Soto ]
All code in my posts, unless a source is explicitly mentioned, is my own.
Joined: Nov 26, 2008
Thanks for the suggestion. I did super.equals(b) and also testequalobjx.super.equals(b) But by doing that it will not compare two Carx objects but compare the object testequalobjx to a Carx object using testequalobjx' equals(). I looking for something that uses Object class equals() and compare two Carx objects. Carx a object.object class' equal method (Carx b object) -- Also it will not run the Object class' equals() method if the superclass of the testequalobjx also has overriden the equals() method. I have another interesting question on deserialization. I have posted that with subject as "Serialization: Non serialized class issue". I'll appreciate if you guys can comments on that too.
[ December 31, 2008: Message edited by: Ajit Sawant ]
Oh because super only works from an instance context? I don't understand the point of this exercise [ January 02, 2009: Message edited by: Duran Harris ]
Joined: Oct 16, 2008
Ya super is counterpart of this. this means current object, super means current object' super class.
There is nothing great to understand in this program. Ajit has overriden equals() method and testing his equals() method, but he also wants to call superclass's Object equals() method at the same time. But he was not able to do this, not able to find how to use super construct to call Object's equals() method, thats it.
subject: Invoking Object superclass's method outside of subclass when the method is overriden?