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...

Difference between overloading and Overriding. <Giving a
confusing example to test the concept.>
(also asked in PA Consultancy Group,iflex,Value
chain,IBM,CTS,Accenture, Tarang>

Answer Posted / ketan gambhir

Overloading:-in overloading,we can use same name of method
and constructor with different parameters in same class.
For Exa:-
\\Both methods has different declaration and definition.
class A
{
public int same(int a int b)
{
return a+b;
}
public void same()
{
System.out.println("ketan");
}
}
Overriding:-In overriding,we can use same method and
constructor with same parameters in different classes.
For Exp:-
class A
{
public void same()
{
System.out.println("same1");
}
}
class B
{
public void same()
{
System.out.println("ketan");
}
}

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you create a method in java?

940


What does nullpointerexception mean?

1021


What is boolean false?

928


what is interface in java? Explain

902


This abstract class is correct ? abstract class A { public abstract void Disp(); public abstract void B() { } public absract virtual C() { } }

938


Difference between stack and queue?

1013


Can java run on google chrome?

1134


What is sortedmap in java?

973


What is use of set in java?

922


What is a boolean expression in java?

977


How do you invoke a method?

949


Why are the methods of the math class static?

1022


what is the purpose of the runtime class?

1012


What do you mean by collectors in java 8?

883


How do you define a method?

923