File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes OVERLOAD&OVERRIDE Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "OVERLOAD&OVERRIDE" Watch "OVERLOAD&OVERRIDE" New topic
Author

OVERLOAD&OVERRIDE

asin lin
Greenhorn

Joined: Feb 18, 2004
Posts: 2
Hi Guys
Pleas tell me....
How to distinguish the practical urage between [OVERLOAD] and [OVERRIDE]?
And in what way can they be applied to?
thanks a lot
Chengwei Lee
Ranch Hand

Joined: Apr 02, 2004
Posts: 884
Think illustration by examples would be easier for you to understand:
Method overloading:

Method Overriding:


SCJP 1.4 * SCWCD 1.4 * SCBCD 1.3 * SCJA 1.0 * TOGAF 8
Joel McNary
Bartender

Joined: Aug 20, 2001
Posts: 1815
Message overloading is having the same method name with different parameters:

method overriding happens when a subclass changes the behaviour of one of its superclasses by implementing the same method in a different way. For example:

This example shows that objects that are Mammals give birth to live young. However, Monotremata (which includes the platypus and the echidna), while they are mammals, lay eggs instead of giving birth to live young. Also, marsupials (kangaroos, opossums, koalas, etc.) give birth to live young but then put the young in a pouch.
An important difference to note is that overloaded methods are bound at compile-time, while overridden methods are determined at run-time.


Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
Anderson leeak
Greenhorn

Joined: Apr 09, 2004
Posts: 4
OverLoading means there will not less than one same method,but these method can have
different arguments for every method.
OverRiding just happened when a subclass entends its superclass by implementing the
same method in a different way. But how the OverRiding is happened in the run-time which
can be called late-binding.but the OverLoading is bound at complie time.
I want to apologize for my poor english,because i came from china.so english is not so good.
thansk
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
thinkpad leeak,
Welcome to JavaRanch!
We do not have a lot of rules around here, but we do got one. Please change your display name to comply with The JavaRanch Naming Policy.
Thanks Pardner! Hope to see you 'round the Ranch!


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: OVERLOAD&OVERRIDE
 
Similar Threads
method invocation
can a class or a java file have more than one "main "method?
Overriding
WA #1.....word association
Can Interface methods overload and override