-
What is the output of this program?
public class output
{
public static void main(String args[])
{
String str1 = "Intervzew Manza";
String str2 = str1.replace('z','i');
System.out.println(str2);
}
}
-
- Intervzew
- Manza
- Interview Mania
- IntervzewManza
- None of these
Correct Option: C
replace() method replaces all occurrences of one character in invoking string with another character. str1.replace(‘z’,’i’) replaces every occurrence of ‘z’ in hello by ‘i’, giving Interview Mania.