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 a pattern what is an anti pattern?
Does substring start with 0?
What is callablestatement? How you can call stored procedure to pass in parameter?
Define Multiprogramming and Multiprocessing in java.
List implementations of list interface?
What are thread groups?
Is string an object?
What is your platform’s default character encoding?
Why does java not support operator overloading?
Explain scope or life time of local variables in java?
What is the purpose of the system class in java programming?
when should you use stringbuilder class in a program?
What is a get method?
What is java volatile?
What is module in project?