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


Is it possible to do method overloading and overriding at a
time

Answers were Sorted based on User's Feedback



Is it possible to do method overloading and overriding at a time..

Answer / shashi

Yes, Is it possible to do method overloading and overriding at a
time

***********************************************


class A
{
void Add(int x, int y)
{
System.out.println("Hello From Class A" + (x+y));

}
}
class B extends A
{
void Add(int x, int y)
{
System.out.println("Hello From Class B" + (x+y));

}
void Add(double x, double y)
{
System.out.println("Hello From Class B" + (x+y));

}

}
class Test
{
public static void main(String ar[])
{
B acv = new B();
acv.Add(100.0,20.0);
acv.Add(10,20);
}
}

Is This Answer Correct ?    19 Yes 0 No

Is it possible to do method overloading and overriding at a time..

Answer / rameshreddy

No it is not possible at a time. Method overloading is
possible in the same class is possible. But method
overriding is possible its subclass only possible

Is This Answer Correct ?    18 Yes 6 No

Is it possible to do method overloading and overriding at a time..

Answer / sathishkumar.m

class A
{
int c;
void add()
{
System.out.println("hai");
}
void add(int b)
{
c=b;
System.out.println("value of b:"+c);
}
}
class B
{
int e;
void add(int d)
{
System.out.println("value of d:"+e);
}
}
class Demo
{
public static void main(String aa[])
{
A o1=new B();
o1.add();
}
}

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More Core Java Interview Questions

Explain different ways of creating a thread. Which one would you prefer and why?

0 Answers  


What is the benefit of inner classes in java?

0 Answers  


When should I use singleton?

0 Answers  


What Is Composition?

0 Answers   IBS,


How many types of thread in java? give the name

13 Answers   Cisco, NIIT,


Can java arraylist hold different types?

0 Answers  


What happens if we don’t override run method ?

0 Answers  


What is an object's lock and which object's have locks in java programming?

0 Answers  


I want to print “hello” even before main is executed. How will you acheive that?

0 Answers  


How to create a fecelet view?

0 Answers  


Why java is call by value?

0 Answers  


What are local variables?

0 Answers  


Categories