• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

boxing ,widening,var-args

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

output: DoX(s,s)=4 doX(7,7)=3

according to me doX(s,s) must be 3 i.e widen and then boxing then why its 4 i.e boxing and then widening.
[edit]Add code tags and disable smilies. CR[/edit]
[ December 06, 2008: Message edited by: Campbell Ritchie ]
 
Marshal
Posts: 80612
467
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There isn't anything to widen to; the only thing that a short can be boxed to is Number (Short is a subclass of Number).

And please use the code tags; I have added them and you can see how much easier it is to read.
 
Sheriff
Posts: 22848
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A short can never be converted into an Integer, so all that remains is Short, Number or Object.

You can't widen then box, only box then widen
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic