Computer Applications

Which of the following String methods results into boolean data type?

  1. trim()
  2. equals()
  3. replace()
  4. concat()

Java String Handling

16 Likes

Answer

equals()

Reason — In Java, the equals() method compares the contents of two strings and returns a boolean value (true or false), whereas trim(), replace(), and concat() return new strings, not boolean values.

Answered By

6 Likes


Related Questions