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
Can we clone singleton object?
Explain the importance of finally block in java?
What is the difference between Java Program Constructor and Java Program Method, What is the purpose of Java Program constructor Please Explain it Breafily?
What is meant by oops concept in java?
What is the difference in between cpp and java? Can u explain in detail?
What is the difference between form & report?
What is an infinite loop?
How is string stored in java?
Can bool be null?
Can an unreferenced object be referenced again?
How to implement a multithreaded applet?
If a variable is declared as private, where may the variable be accessed?
What is wrapper class html?
how to handle exceptions in ejb?
how would you implement a thread pool? : Java thread