• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Overloading

 
anita dhar
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Deepak Jain
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Mohammad Hossain
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic