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


explain about method overloading and method overriding with
difficult examples

Answers were Sorted based on User's Feedback



explain about method overloading and method overriding with difficult examples..

Answer / bhasker

Method Overloading:
--------------------
Method Overloading is nothing but the method name is
same and the number of parameters and types of parameters
are different.

Method Overriding:
--------------------
Method Overriding is nothing nut the super class
method signatuer we can inherit to the sub class method
signature is shoub be same.

Is This Answer Correct ?    12 Yes 0 No

explain about method overloading and method overriding with difficult examples..

Answer / suja

Overloading:
Method Overloading, allows the user to achieve the compile time polymorphism.Overloaded methods are always the part of the same class. These methods have the same name, but they may take different input parameters.The arguments passed to a overloaded method may differ in type or in number, or both.
Overloaded methods may have the same or different return types.
Overriding:
Method overriding in java means a subclass method overriding a super class method. Superclass method should be non-static. Subclass uses extends keyword to extend the super class. In the example class B is is the sub class and class A is the super class. In overriding methods of both subclass and superclass possess same signatures. Overriding is used in modifying the methods of the super class. In overriding return types and constructor parameters of methods should match .

Is This Answer Correct ?    5 Yes 0 No

explain about method overloading and method overriding with difficult examples..

Answer / andrea

overloading
two or more methods will have same name but different
arguments. it will be in same class.
overriding
two or more methods will have same name and same
number of arguments but in different classes

Is This Answer Correct ?    5 Yes 4 No

explain about method overloading and method overriding with difficult examples..

Answer / mayank sharma

Clas A
{
Virtual void hi(int a)
{
}
}

Class B:A
{
public overrid void hi(int a)
{

}
}

Overloading simply involves having a method with the same
name within the class.

Example for Over loading

Class A
{
class a()

{

}
class a(int a)
{
}
}

Is This Answer Correct ?    0 Yes 2 No

Post New Answer

More Core Java Interview Questions

What is method reference?

0 Answers  


Is ++ operator is thread safe in java?

0 Answers  


Which way a developer should use for creating thread, i.e. Sub classing thread or implementing runnable.

0 Answers  


What is the impact of declaring a method as final?

0 Answers  


Can a method inside a interface be declared as final?

0 Answers  


Explain spliterator in java8?

0 Answers  


What are green threads in java?

0 Answers  


If your team member writes code with lots of static variables and static methods, will it cause any side effects?

3 Answers   KPIT,


What is the difference between heap memory and stack memory?

0 Answers   Aspiring Minds,


Does java runtime require a license?

0 Answers  


What is java and its types?

0 Answers  


What are thread groups?

0 Answers  


Categories