File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Unboxing to vararg Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Unboxing to vararg" Watch "Unboxing to vararg" New topic

Unboxing to vararg

O. Ziggy
Ranch Hand

Joined: Oct 02, 2005
Posts: 430

Why does this fail with a compilation failure?

Stephan van Hulst

Joined: Sep 20, 2010
Posts: 4200

You can only unbox primitive wrappers. Integer[] is not a primitive wrapper, it's an array.

The mind is a strange and wonderful thing. I'm not sure that it will ever be able to figure itself out, everything else, maybe. From the atom to the universe, everything, except itself.
O. Ziggy
Ranch Hand

Joined: Oct 02, 2005
Posts: 430

It is sorta covered in the JavaRanch Style Guide.
subject: Unboxing to vararg
It's not a secret anymore!