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 / abhijit ghosh
It is neither overriding nor overloading.
because class A and B are two different and independent
classes. So "disp" function for both are completely bound by
the scope of their respective classes or more to say to the
objects of respective classes. Therefor,
if aa and bb are two objects of class A and B respectively
then
aa.disp() and bb.disp()will be two distinct function of two
different objcts of different classes only.
| Is This Answer Correct ? | 30 Yes | 4 No |
Post New Answer View All Answers
Can we use both this () and super () in a constructor?
What is the difference between length and length() method in java?
What are multiple inheritances? Is it supported by java?
Should a main method be compulsorily declared in all java classes?
Is oracle java 11 free?
Can we instantiate interface in java?
What is boolean keyword in java?
Is math an abstract class in java?
What is the difference between a factory and abstract factory pattern?
Where we write javascript code in html page?
What is the private method modifier?
What is the difference between menuitem and checkboxmenu item?
what is a green thread? : Java thread
What is the internal implementation of set in java?
State some situations where exceptions may arise in java?