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 are methods?
What is the use of static class?
Does the order of public and static declaration matter in main method?
What is a control variable example?
What does flagged out mean?
What is the difference between Grid and Gridbaglayout?
Why unicode is important?
What is the purpose of javac exe?
Can we create an object if a class doesn't have any constructor ( not even the default provided by constructor ) ?
What is meant by structural programming?
How do you check whether the list is empty or not in java?
Can we use synchronized block for primitives?
What is bifunction in java?
Why is a constant variable important?
Can variables be used in java without initialization?