Domanda di colloquio di Lockheed Martin

In Java 1.6, what is autoboxing? When does it occur?

Risposta di colloquio

Anonimo

16 ago 2010

Autoboxing automatically casts from primitive data types to their object wrappers and back. It occurs at runtime - I said I was like 80-90% sure on that, but I'd want to look it up before I put money on it. There were only a couple of cases I could think of when it couldn't happen at compile time, and I wasn't sure if they really mattered. The interviewer said that was a good answer.

1