aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Overloading Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Overloading " Watch "Overloading " New topic
Author

Overloading

anita dhar
Ranch Hand

Joined: Jul 14, 2007
Posts: 69
Hello java ranchers,
I am confused with overloading ? can any one explain me this concept properly with example where we can go for overloading and where we are restricting

thanks in advance
ailina nagarawati
Greenhorn

Joined: Jul 25, 2007
Posts: 4
Hi,

overloading basically means you modify a method so that it can accept different arguments.. (arguments are the variables inside the bracket)

for example:
you have a method:

public void doSomething(int a, int b){}

if you overload it so that the method can accept "double type" arguments, you might have something like this:
public void doSomething(double a, double b){}

for more info:
http://java.ittoolbox.com/documents/popular-q-and-a/overloading-and-overriding-3699
Anurag Blore
Ranch Hand

Joined: Jan 15, 2003
Posts: 74
Please remember key points.

1. Overloading happens in a single CLASS

Other rules taken from Kathy Sierra book

Overloaded methods
Must have different argument lists
May have different return types, if argument lists are also different
May have different access modifiers
May throw different exceptions


Thanks,
Anurag
SCJP 1.2 & 1.5, PMP
Deepak Jain
Ranch Hand

Joined: Aug 05, 2006
Posts: 637
Hi Anee,
My suggestion would be , you pick up some java book go through overloading and overriding concepts and then come back with specific doubts and we will be glad to answer them. This will only help you to understand the concept better so that you will remember them for a longer duration.
If you read them and try them you will find many small concepts hidden in them which i dont think will be covered over this forum.
I don't mean to offend its just a suggestion.
Thanks
Deepak
[ August 12, 2007: Message edited by: Deepak Jain ]

SCJP, SCWCD, SCBCD
Mohammad Hossain
Greenhorn

Joined: Jul 26, 2007
Posts: 14
Ya thats right.
I would suggest read some books, try some examples, find out some specific questions and post them here.
Because only a forum is not enough to explain overloading. There are many exceptions. And if people don't explain all of them to you. You will become more confused.
If that sounds offended I am really sorry for that. I just wanted to help.
Thanks


Live Free Or Die
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Overloading