Computer Science, asked by JanmejoyPradhan, 6 months ago

Wap in java to take a word as input and then replace all letter a with letter b​

Answers

Answered by armysoopa
0

Answer:

sorry I am not give the answer of this question

Answered by Tulsi4890
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