Q. What is the purpose of the trim() method of a String object in Java? (A) To remove all spaces from the string (B) To concatenate two strings (C) To extract a substring from the string (D) To remove leading and trailing whitespace ποΈ Show Answer π¬ Discuss π Share β‘Menu β Correct Answer: (D) To remove leading and trailing whitespace