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 the size of a string in java?
Can we restart a thread already started in java?
What is java full form?
Difference between a process and a program?
What is the difference between final, finally and finalize()?
Explain the difference between throw and throws in java?
Write a function to find out longest palindrome in a given string?
Explain java heap space and garbage collection?
How do you compare values in java?
What is the importance of hashcode() and equals() methods?
Is there any case when finally will not be executed?
How do you ensure that n threads can access n resources without deadlock?
What are the basic concepts of OOPS in java?
What is Java Annotations?
What is the purpose of the System class?