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


Please Help Members By Posting Answers For Below Questions

Differentiate between a constructor and a method? Can we mark constructors final?

671


How do you use find and replace?

509


What is a priority queue java?

523


Is string pool garbage collected?

545


What is vector?

586






What is reverse function?

571


What is lambda in java?

515


What does += mean coding?

508


How can you avoid serialization in child class if the base class is implementing the serializable interface?

631


What is get () in java?

562


What java is used for?

656


What about member inner classes?

625


Is hashset ordered java?

586


Why do we need data structure in java?

572


Does constructor creates the object ?

580