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 difference between method overloading & method
overridding with example?

Answers were Sorted based on User's Feedback



what is difference between method overloading & method overridding with example?..

Answer / tamilvanan

overloading:
method overloading means method name is same and different
parameter ie different signature.. and overloading method
are present in same class
for eg ,
let us consider show() is a method
1.show(int a)
2.show(int a,int b)
overriding:
method overriding means method name is same and
parameter also same. these are present in different levels
of class
for eg,
let us consider show() is a method
1.show(int a)
2.show(int a)

Is This Answer Correct ?    34 Yes 0 No

what is difference between method overloading & method overridding with example?..

Answer / dipesh

Overloading-->method with different signature
Overriding -->method with same signature

Is This Answer Correct ?    23 Yes 0 No

what is difference between method overloading & method overridding with example?..

Answer / rana.ankur

overloading:
class A
{
Num(int a)
{
System.out.println("a: " + a);

}
Num(int a,int b)//overloading
{
System.out.println("a and b: " + a + " " + b);

}
CLass Overloading
{
public satic void main(Stinr ar[])
}
A a=new A()
a.Num(12);
a.Num(12,12);
}
}//thanks

Is This Answer Correct ?    2 Yes 0 No

what is difference between method overloading & method overridding with example?..

Answer / sirisha

overridding:
same method name and same signature.
import java.io.*;
class sum
{
int a=10,b=15;
void sum()
{
int sum=a+b;
System.out.println("sum is:"+sum);
}
}
class sum1 extends sum
{
int c=20;
void sum()
{
int sum1=a+b+c;
System.out.println("sum1 is:"+sum1);
}
}
class override{
public static void main(String[] arg){
sum s=new sum();
s.sum();
sum1 s1=new sum1();
s1.sum();
}
}

over loading:
method name same but different signature.
class sum{
void add(int a,int b){
}
class sum{
void add(string s1,string s2){
}

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More Core Java Interview Questions

Why does java doesnt suuport unsigned values?

0 Answers   ABC,


What does super()represent, and how is it used in Java?

2 Answers  


Difference between abtsract & final

1 Answers   Nous,


A class can be a subclass of itself?

2 Answers   Genesis,


What is default exception handling in java?

0 Answers  


Can we override tostring method in java?

0 Answers  


Can a constructor call the constructor of parent class?

0 Answers  


Java Compiler is stored in JDK, JRE or JVM?

0 Answers  


What are advantages and disadvantages of OOPs?

0 Answers   Amdocs,


program to validate the IP address? Validity range should be 0 to 255

1 Answers   Huawei,


What is the difference between jsp and servlet?

6 Answers   Symphony,


What are benefits of java?

0 Answers  


Categories