class A
{
public void disp(int a,int b)
{
System.out.println("hai");
}
}
class B
{
public void disp(int a,int b,int c)
{
System.out.println("hai");
}
}
above program is overloading or overriding?
Answer Posted / pravallika
There is no relation between both the classes,so it is neither
overloading nor overriding.overloading and overriding means IS-A Relationship must be there in both the classes.
for ex:
class A
{
public void disp(int a,int b)
{
System.out.println("hai");
}
}
class B extends A
{
public void disp(int a,int b,int c)
{
System.out.println("hai");
}
}
the above program is overloading,because Is-A Relationship is available in both the classes.
| Is This Answer Correct ? | 11 Yes | 5 No |
Post New Answer View All Answers
What is import java util arraylist?
What are the characteristics of Final,Finally and Finalize keywords.
What is treeset in java?
What is the major advantage of external iteration over internal iteration?
What is this () in java?
What are data structures in java?
What are void methods?
Can we create our own wrapper class in java?
Explain the importance of thread scheduler in java?
What is getkey () in java?
What are the types of collections in java?
Do you know how to reverse string in java?
Can inner class be public in java?
Why can't you declare a class as protected?
Can we override constructor in java?