English

Which of the following returns a String? - Computer Applications

Advertisements
Advertisements

Question

Which of the following returns a String?

Options

  • length()

  • charAt(int)

  • replace(char, char)

  • indexOf(String)

MCQ

Solution

replace(char, char)

Explanation:

The method replace(char oldChar, char newChar) returns a new String with all occurrences of oldChar replaced by newChar. This method does not modify the original string but produces a new one with the specified replacements.

shaalaa.com
String Array
  Is there an error in this question or solution?
2024-2025 (April) Specimen Paper
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×