Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what is overloading in java?

Answer Posted / binod kumar

IF WE HAVE SAME METHOD NAME WITH DIFFERENT TYPES OF PARAMETERS THEN IT IS KNOWN AS METHOD OVERLOADING.
EXAMPLE----------->

class A
{
void sum(int a,int b)

{
int s=a+b;
System.out.println("Sum of a+b is:" +s);

}
void sum(int x,int y,int z)
{
int s2=x+y+z;
System.out.println("Sum of x+y+z is:" +s2);

}
}

class ovrloading
{

public static void main(String str[])

{
A a=new A();
a.sum(10,20);
a.sum(10,20,30);
}
}
IN GIVEN EXAMPLE WE HAVE SUM METHOD WITH DIFF PARAMETERS.
OUTOUT WILL BE------->
Sum of a+b is: 30
Sum of x+y+z is: 60

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the benefit of using enum to declare a constant?

1099


What is a literal coding?

1018


What are the advantages of exception handling in java?

1052


How to display all the prime numbers between 1 and 100

1008


Explain methods specific to list interface?

968


If a class is declared without any access modifiers, where may the class be accessed in java programming?

1208


Why is multithreading important?

937


What is the final keyword in java?

1417


What do you mean by singleton class in java?

901


Define linked list and its features with signature?

985


Can constructor be static or final?

1084


What flag up means?

1025


if u open login & logout ,how can udisplay the timelogin & logout members ?

2278


What is java string pool?

999


What was java originally called?

950