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 the purpose of the finalize() method?
Can I declare class as static or private?
Why string is a class?
Where and how can you use a private constructor?
Why is it called buffering?
What is the purpose of using break in each case of switch statement?
Can a constructor be private and how are this() and super() method used with constructor?
What are the methods of object class ?
What is Session reduplication and how its done?
What is replacefirst in java?
Which language is java?
What are different types of constants?
What is immutable class in java?
What is the purpose of void?
Explain the selection sort algorithm?