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
πŸ’¬ Discuss
βœ… Correct Answer: (D) To remove leading and trailing whitespace

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
250
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Vinay
Publisher
πŸ“ˆ
82%
Success Rate