Recall & Review
beginner
What is unboxing in Java?
Unboxing is the automatic conversion of an object of a wrapper class (like Integer) to its corresponding primitive type (like int).
touch_appClick to reveal answer
beginner
Which of these is an example of unboxing?
Integer num = 10;
int n = num;
Assigning an Integer object to an int variable automatically converts the Integer to int. This is unboxing.
touch_appClick to reveal answer
beginner
Why is unboxing useful in Java?
Unboxing lets you use wrapper objects like primitive types without manually converting them, making code simpler and easier to read.
touch_appClick to reveal answer
intermediate
What happens if you unbox a null wrapper object?
Unboxing a null wrapper object causes a NullPointerException because there is no primitive value to convert.
touch_appClick to reveal answer
beginner
Which wrapper classes support unboxing in Java?
All wrapper classes like Integer, Double, Boolean, Character, Byte, Short, Long, and Float support unboxing to their respective primitive types.
touch_appClick to reveal answer
What does unboxing do in Java?
What will happen if you try to unbox a null Integer object?
Which of these is an example of unboxing?
Which wrapper class does NOT support unboxing?
Unboxing helps to:
Explain what unboxing is and give a simple Java example.
What error can occur during unboxing and why?
