Exam 15-16 02 Flashcards
1
Q
Specify TWO primitive types and TWO reference types that
exist within the Java Standard Edition library. Ensure at least
one of your reference types is a wrapper class. Your answer
should be case sensitive.
A
Primitive: Integer(int), Boolean
Reference type: String, Array
2
Q
Explain what is meant by autoboxing and unboxing. You should
provide an example to illustrate your answer.
A
Autoboxing is the automatic conversion between primitive types and their corresponding object wrapper classes.
Example: Converting an Int = integer, double to Double.
Unboxing is when the conversion goes the other way. Wrapper class to primitive type.