This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
actually this is related to overriding
in the subclass
you are writing the method which override the superclass methods
and overriding method rules say that
the return type should be same or the subclass of the return type This is not about boxing and unboxing
SCJP 6 [86%] June 30th, 2010
OCPWCD [84%] March 26th, 2013
If you find any post useful, click the "plus one" sign on the right
Joined: Oct 24, 2010
Hi Prasad, I think you are referring about covariant return types. I am looking for this "In some cases, is-a relationships are used in the process of autoboxing.: TRUE..How ?? Please provide an example, that would be really helpful. "
Then your query is simple
this is a sample program that can make you understand the concept
here we are returning an int value that is getting autoboxed into Integer
and Integer IS-A Number
so return type Number is also valid