ICSE Class 10 Computer Applications Question 37 of 46

String Handling — Question 1

Back to all questions
1
Question

Question 1

The trim() method of the String class removes ............... .

  1. leading spaces only
  2. trailing spaces only
  3. spaces in between words
  4. leading and trailing spaces
Answer

leading and trailing spaces

Reason — The trim() method of the String class removes the leading and trailing spaces from a string. It does not remove the spaces present in between the string.