‹ Back to the paper
What are Wrapper classes? Give any two examples.
Answer
Answer
AIWrapper 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).
From ISC 2018 Computer Science Paper 1, question 2(a).