Autoboxing in Java is the automatic conversion of primitive types to their corresponding wrapper classes, while Unboxing is the reverse — converting wrapper objects back to primitives. Introduced in Java 5, these features simplify code and allow primitives to work seamlessly with collections and generics.
Time limit: 0
Quiz Summary
0 of 15 Questions completed
Questions:
Information
You have already completed the quiz before. Hence you can not start it again.
Which Java version introduced autoboxing and unboxing?
Correct
Incorrect
Question 4 of 15
4. Question
Which of the following demonstrates autoboxing?
Integer num = 5;
Correct
Incorrect
Question 5 of 15
5. Question
Which class is used in autoboxing of double?
Correct
Incorrect
Question 6 of 15
6. Question
Which is an example of unboxing?
Correct
Incorrect
Question 7 of 15
7. Question
Which of these collections rely on autoboxing?
Correct
Incorrect
Question 8 of 15
8. Question
Which primitive type matches the wrapper class Character?
Correct
Incorrect
Question 9 of 15
9. Question
Which is not a wrapper class in Java?
Correct
Incorrect
Question 10 of 15
10. Question
Can autoboxing cause NullPointerException?
Correct
Incorrect
Question 11 of 15
11. Question
What is the wrapper class for primitive byte?
Correct
Incorrect
Question 12 of 15
12. Question
Which code causes unboxing?
Integer obj = new Integer(20); int val = obj;
Correct
Incorrect
Question 13 of 15
13. Question
What will happen in this code?
Integer x = null; int y = x;
Correct
Incorrect
Question 14 of 15
14. Question
Which method manually converts primitive to wrapper?
Correct
Incorrect
Question 15 of 15
15. Question
Which of the following is true?
Correct
Incorrect
Summary
Autoboxing and Unboxing are powerful features introduced in Java 5 that automate conversion between primitive types and wrapper classes. This enables smoother use of collections, better readability, and less manual code. However, developers must handle null values carefully during unboxing to avoid runtime exceptions.
At QuizOrbit, our team specializes in fun, informative quizzes across topics like general knowledge, technology, and entertainment. Boost your knowledge with our expert-designed quizzes.