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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is object in java?

531


What does void * mean?

530


Considering notepad/ie or any other thing as process, what will happen if you start notepad or ie 3 times? Where 3 processes are started or 3 threads are started?

653


Name few java 8 annotations ?

563


take an array with -ve and +ve value both.find out the nearest value of 0(zero).if two values are same like(-2 and +2)then extract +2 is nearest of 0(zero).

1530






Explain the concept of hashtables?

611


What is a flag variable?

557


Explain the private protected method modifier?

544


What is stringwriter?

537


Write a regular expression to validate a password. A password must start with an alphabet and followed by alphanumeric characters; its length must be in between 8 to 20.

588


Why inputstreamreader is used in java?

545


What is java lang string?

544


Is oracle java 11 free?

526


What is the difference between post and put?

533


Explain the difference between abstraction and encapsulation.

535