Wap in java to take a word as input and then replace all letter a with letter b
Answers
Answered by
0
Answer:
sorry I am not give the answer of this question
Answered by
0
The program is given below:
import java.util.*;
public class Main
{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
String w=sc.next();
String ans=w.replace('a','b');
System.out.println(ans);
}
}
input: aradhya
output: brbdhyb
In the above program, we simply used the replace method defined in string class which takes two arguments the character to be replaced and the character with which it has to replace.
Similar questions
Political Science,
3 months ago
Math,
3 months ago
Math,
6 months ago
Environmental Sciences,
9 months ago
Physics,
9 months ago
English,
9 months ago