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?

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

Who developed java?

999


What are the super most classes for all the streams?

2567


What language is an assembler written in?

1000


Is void a data type in java?

994


What will happen if non-synchronized method calls a static synchronized method and what kind of lock it acquires?

1114


What are features of java?

1027


Explain numeric promotion?

1108


What is square root in java?

1112


Why to use nested classes in java? (Or) what is the purpose of nested class in java?

1074


Can a class be final?

943


Can you pass by reference in java?

983


What is the meaning of 3 dots in java?

1166


Why wait(),notify(),notifyAll() methods defined in Object class althought we are using in only threads.

2824


Tell me about different OOPS concepts.

1007


What is the default access specifier for variables and methods of a class?

1207