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
What is object in java?
What does void * mean?
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?
Name few java 8 annotations ?
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).
Explain the concept of hashtables?
What is a flag variable?
Explain the private protected method modifier?
What is stringwriter?
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.
Why inputstreamreader is used in java?
What is java lang string?
Is oracle java 11 free?
What is the difference between post and put?
Explain the difference between abstraction and encapsulation.