PRASHNIKAप्रश्निका
Back to the paper

What are Wrapper classes? Give any two examples.

Computer Science20182 marksShort answer

Answer

Answer

AI
Wrapper classes are classes provided by Java that 'wrap' (encapsulate) a primitive data type inside an object, so that a primitive value can be treated as an object (e.g. for use in collections, or to access utility methods such as converting/parsing strings to numbers). Every primitive type has a corresponding wrapper class. Examples: Integer (wraps int), Character (wraps char) - (any two, e.g. Double for double, Boolean for boolean, are equally acceptable).
Primitive values, Wrapper classes, Types and casting

From ISC 2018 Computer Science Paper 1, question 2(a).