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
Differentiate between a constructor and a method? Can we mark constructors final?
How do you use find and replace?
What is a priority queue java?
Is string pool garbage collected?
What is vector?
What is reverse function?
What is lambda in java?
What does += mean coding?
How can you avoid serialization in child class if the base class is implementing the serializable interface?
What is get () in java?
What java is used for?
What about member inner classes?
Is hashset ordered java?
Why do we need data structure in java?
Does constructor creates the object ?