The wrapper classes cannot be used like primitives



3) Compile time error

The wrapper classes cannot be used like primitives.

Depending on your compiler you will get an error that says someting like “Error: Can’t convert java lang Integer”. Wrapper classes have similar names to primitives but all start with upper case letters.

Thus in this case we have int as a primitive and Integer as a wrapper. The objectives do not specifically mention the wrapper classes but don’t be surprised if they come up.


Print Friendly, PDF & Email


發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

這個網站採用 Akismet 服務減少垃圾留言。進一步瞭解 Akismet 如何處理網站訪客的留言資料