aspose file tools*
The moose likes Beginning Java and the fly likes Overridding!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Overridding!!" Watch "Overridding!!" New topic
Author

Overridding!!

divya sharma
Ranch Hand

Joined: Jan 25, 2007
Posts: 87
Hello,

Please help me to understand over ridding concept.

Thanks
Divya


Divya
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24168
    
  30

Read this. Should help you out!


[Jess in Action][AskingGoodQuestions]
divya sharma
Ranch Hand

Joined: Jan 25, 2007
Posts: 87
Thanks for your reply!!!

If property of the method could be modified then what is overloading? As per my understanding Overloading is multiple methods with different parameters, but the methods do the same thing.
Anton Uwe
Ranch Hand

Joined: Jan 10, 2007
Posts: 122
Overloading: Multiple methods with different parameters, all methods have the same name, but they can do whatever they want.

example:
Madhusudan Banik
Greenhorn

Joined: Jan 14, 2007
Posts: 10
Overriding means rewrite the inherited behaviors. It something�s like overwrite a file into our file system. When we a save a file name test.txt and the directory already contains a file with similar name then a message come to inform that. Anyway overriding comes into contact when a class extends another class. A class can overrides the inherited methods. Not all inherited method can be overridden. Static, final method cannot be overridden. Overriding introduce another complexity like which method implementation is bind to a method invocation. These things will be found on book.
divya sharma
Ranch Hand

Joined: Jan 25, 2007
Posts: 87
Please explain me some think more as i an still confusted b/w overridding and over loading

thanks,
divya
Madhusudan Banik
Greenhorn

Joined: Jan 14, 2007
Posts: 10
In overriding method signature(method name+parameter type) need to be same but in overloading method signature must be different. Think we need square root of double, long, float, int type, then what i we could do. define different method for each data type. like for double sqdouble(double d), for int, sqrint(int i), etc. If we do that it will creates some problem, such that user of the method must know that which version of the method square root we need to call. to remove such difficulties we use overloadding. we use the same func sqr(double d), sqr(int i), etc. More on found on book.
Damodara Reddy
Ranch Hand

Joined: Feb 09, 2007
Posts: 44
Overloading : Having multiple methods with different method signatures( parameters + return type) ,
In the case of overloading , method is called upon the matching of method signature, and this will be determined at the time of compilation(Early binding/compile time polymorphism).

Overriding : This comes with point of inheritance,
method name+ parameters + return type must be same as of the method in the super class which we want to override.

Overriding is done when you want to replace particular method's functionality in the subclass.
JVM determines which method to call at run time.( This is called as Late binding/ Run time polymorphism).


Damu
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Overridding!!