Anand Shrivastava
SCJA
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Originally posted by Anand Shrivastava:
[QB]
If Number is a superclass then the short should have been boxed in Number as Boxing and widening is allowed, instead of being boxed in Short. [QB]
Originally posted by Anand Shrivastava:
[QB]
Secondly, why the compiler will automatically box the short to Short without any explicit statement for that. Can someone throw some light on this.
QB]
The future belongs to those who believe in the beauty of their dreams.Dream BIG!
Anand Shrivastava
SCJA
SCJP 5.0
Originally posted by Anand Shrivastava:
Nabila Thanks,
Just it came to my mind, what we are upto,
ultimately we are doing,
Number = Short
Number is a superclass.
or in otherwords,
Superclasstype = Subclass object,
this is upcasting,
infact we are narrowing it (so the term boxing and narrowing should have been used![]()
The future belongs to those who believe in the beauty of their dreams.Dream BIG!
2.static int dox(long...x) {return 2;}
SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Anand Shrivastava
SCJA
Consider Paul's rocket mass heater. |