Results 1 to 2 of 2
- 10-17-2011, 12:41 AM #1
Whats the different between package.class.method and super.method?
Example:
Java Code:public String toString () { //This is to its super class String obj = super.toString (); return obj; }Do one of these have benefits? Or are the effects exactly the same?Java Code:public String toString () { //This is to its super class String obj = packagename.classname.toString (); return obj; }
-
Re: Whats the different between package.class.method and super.method?
The first code simply calls the super's method whatever that is. If the super does not override Object's toString() method, this won't be terribly helpful and will just return the object type and its hashCode. The second returns the class's name.
The toString() method should be whatever works best for debugging your program.
Similar Threads
-
problem in set & get method of a super class
By elenora in forum Advanced JavaReplies: 5Last Post: 04-22-2011, 01:42 PM -
super class reference variable accesses overriding sub class method
By subith86 in forum New To JavaReplies: 5Last Post: 01-26-2011, 06:38 PM -
calling method of different project package class
By oneofthelions in forum New To JavaReplies: 3Last Post: 02-16-2010, 05:36 PM -
how to call higher level super class method?
By satheeshtech in forum Advanced JavaReplies: 2Last Post: 01-12-2010, 03:11 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks