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...

There are 2 methods in a class. Both have the same method
signature except for return types. Is this overloading or
overriding or what is it?

Answer Posted / debapriya maity

See overloading has nothing to do with Covariant Return
types ,in fact overloading dosent take into consideration
the return types.

But in case of ovveriding u can provide Covariant return type

say for example

class A {
protected A getModel(){
return this;
}
}
class B extends A{

public B getModel(){

return this
}
}
and there are many other examples of
covariant return types like this.

Since B is A(IS-A RelationShip)
so the return type can be a subclas of the super class

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

If a class is declared without any access modifiers, where can the class be accessed?

1066


Can size_t be negative?

1181


What is balanced tree in java?

974


Why charat is used in java?

1058


What is the difference between a window and a frame in java programming?

1140


Do loops java?

1025


Explain about the performance aspects of core java?

1057


How can an exception be thrown manually by a programmer?

1004


How do you sort arraylist in descending order?

1023


How do you convert bytes to character in java?

1004


How can you read content from file in java?

1007


What is package protected in java?

992


If system.exit (0); is written at the end of the try block, will the finally block still execute?

1112


Which are different kinds of source code?

1113


Does java trim remove newline?

1001