Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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?

Answers were Sorted based on User's Feedback



class A { public void disp(int a,int b) { System.out.println("hai")..

Answer / vijaya mahesh

It is neither overloading nor overriding

Is This Answer Correct ?    44 Yes 4 No

class A { public void disp(int a,int b) { System.out.println("hai")..

Answer / 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

class A { public void disp(int a,int b) { System.out.println("hai")..

Answer / arun

Since two class are not in a not related to each other so
this is neither overloading nor overriding

Is This Answer Correct ?    12 Yes 0 No

class A { public void disp(int a,int b) { System.out.println("hai")..

Answer / shereef.k

It is neither Overloading nor Overriding , because these two methods are defined in two different class, and it can make overlaoding when class B extends Class A. It can never make Overriding because the parameter list in two methods are different.

Is This Answer Correct ?    9 Yes 0 No

class A { public void disp(int a,int b) { System.out.println("hai")..

Answer / 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

class A { public void disp(int a,int b) { System.out.println("hai")..

Answer / raji

class A and class B have same function name but different
arguments.overriding is possible only when both class A and
class B have same function name and same arguments.

Is This Answer Correct ?    7 Yes 2 No

class A { public void disp(int a,int b) { System.out.println("hai")..

Answer / shrirang & chetak

yes, above program is overloading the disp() method

Is This Answer Correct ?    1 Yes 8 No

class A { public void disp(int a,int b) { System.out.println("hai")..

Answer / nagaraj

it is an overriding because we are attempting to riding the already ride class(class B with class A)

Is This Answer Correct ?    2 Yes 11 No

class A { public void disp(int a,int b) { System.out.println("hai")..

Answer / anusha

IT IS METHOD OVERLOADING

Is This Answer Correct ?    4 Yes 13 No

Post New Answer

More Core Java Interview Questions

Explain the importance of import keyword in java?

0 Answers  


What is r * in math?

0 Answers  


How do you clear a list in java?

0 Answers  


What are 3 boolean operators?

0 Answers  


What is skeleton and stub?

0 Answers  


Which class is extended by all other classes?

4 Answers  


Can a main method be overloaded?

0 Answers  


what is purpose of writting public static void main(Strind arg[]) in java..?

4 Answers   ITC Infotech,


How do you sing an Applet ?

0 Answers  


Difference between ?System.out.println? and ?System.error.println??

8 Answers   Sai Softech,


What is bifunction in java?

0 Answers  


what is the difference between String and StringBuffer classes?

2 Answers   Infosys,


Categories