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
Is the empty set a singleton?
What is a generic code?
Should a main method be compulsorily declared in all java classes?
How many bytes is a char in java?
What is a arraylist in java?
What is the difference between Error, defect,fault, failure and mistake?
What is role of void keyword in declaring functions?
What is bubble sorting in java?
What is parameter example?
What is consumer interface?
Is singleton thread safe in java?
What are the two types of streams offered by java 8?
What is the requirement of thread in java?
What does || mean in vectors?
What does it mean that a method or field is “static”?