LIWA

Library Classes

ICSE Class 10 · Computer Applications · Chapter 5

What this chapter covers

Key points

Questions answered

What is a wrapper class? Name the wrapper classes of `char` and `int`.
A wrapper class is a library class that wraps a primitive value inside an object and provides methods for that type. The wrapper of `char` is `Character` and the wrapper of `int` is `Integer`.
Define autoboxing and unboxing, with one example of each.
Autoboxing is the automatic conversion of a primitive value into an object of its wrapper class, for example `Integer n = 10;`. Unboxing is the automatic conversion of a wrapper object back into its primitive value, for example `int m = n;`.
State two differences between a primitive data type and a composite data type.
A primitive type is built into Java and named by a keyword, while a composite type is defined by a class (library or user-written). A primitive variable holds the value itself, while a composite variable holds a reference to an object. (Also accepted: fixed size versus size depending on members; no methods versus methods.)
Why is a class called a user-defined data type?
Once a class is written, its name can be used to declare variables just like `int` or `double`, and each such variable (object) holds the data members and methods the programmer chose. The programmer has therefore created a new type of their own.
Which package contains the wrapper classes? Why do programs not import it?
The `java.lang` package. It is imported automatically into every Java program.
Give the output: `System.out.println(Integer.parseInt("25") + Integer.parseInt("75"));`
`100`, because both strings are converted to `int` before addition.
Give the output: `System.out.println("25" + "75");` and explain the difference from question 6.
`2575`. Here `+` joins two strings; no conversion to numbers takes place.
What happens when `Integer.parseInt("15.5")` is executed? Which method should be used instead?
A `NumberFormatException` occurs at run time because `"15.5"` is not a whole number. `Double.parseDouble("15.5")` (or `Float.parseFloat`) should be used, giving `15.5`.

Past board exam questions

ICSE 2026 board paper · 1 mark

The output of the statement: System.out.println(Character.toUpperCase('b') + 2); is:

  1. 66
  2. 100
  3. 68
  4. 98
Show answer
68

ICSE 2026 board paper · 1 mark

What is the type of parameter to be given for the method parseInt( )?

  1. double
  2. String
  3. char
  4. int
Show answer
String

ICSE 2025 board paper · 1 mark

Character class methods are found in the package called:

  1. java.util
  2. java.lang
  3. java.awt
  4. java.io
Show answer
java.lang

ICSE 2025 compartment paper · 1 mark

What will be the output of the following Java method? Character.isLetterOrDigit('\n')

  1. 1
  2. 0
  3. true
  4. false
Show answer
false

ICSE 2025 compartment paper · 1 mark

Identify the static method from the list given below:

  1. length( )
  2. nextLine( )
  3. substring(int)
  4. isLetter(char)
Show answer
isLetter(char)

ICSE 2025 sample paper · 1 mark

The method to convert a lowercase character to uppercase is:

  1. String.toUpperCase( )
  2. Character.isUppercase ( char )
  3. Character.toUpperCase( char )
  4. toUpperCase ( )
Show answer
Character.toUpperCase( char )

ICSE 2025 board paper · 1 mark

Which of the following converts “25” to 25.0?

  1. Double.Parsedouble(“25”)
  2. Double.parse(“25”)
  3. Double.parseDouble(“25”)
  4. Double.parseDouble(25)
Show answer
Double.parseDouble(“25”)

ICSE 2025 sample paper · 1 mark

Assertion (A): Integer class can be used in the program without calling a package. Reason (R): It belongs to the default package java.lang.

  1. Both Assertion (A) and Reason (R) are true and Reason (R) is a correct explanation of Assertion (A)
  2. Both Assertion (A) and Reason (R) are true and Reason (R) is not a correct explanation of Assertion(A)
  3. Assertion (A) is true and Reason (R) is false
  4. Assertion (A) is false and Reason (R) is true
Show answer
Both Assertion (A) and Reason (R) are true and Reason (R) is a correct explanation of Assertion (A)