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
How do I convert a string to an int in java?
Can we restart a dead thread in java?
What is meant by call by reference?
What does s mean in regex?
What are the practical benefits, if any, of importing a specific class rather than an entire package (e.g. Import java.net.* Versus import java.net.socket)?
Does collectionutils isempty check for null?
Can we overload the constructors?
What are synchronized methods ?
Explain the concept of hashtables?
Is java good for beginners?
Given a singly linked list, find the middle of the list in a single traversal without using temporary variable.
Explain java heap space and garbage collection?
Can we sort set in java?
What is object-oriented programming?
hr interview how many minutes asking question