Computer Science, asked by ka5vyasra8milimahann, 1 year ago

Write a program in java to accept a string in upper case and replace all the vowels present in the string with asterisk(*).

Answers

Answered by Abhinith
4
//accept the string
String str1=in.readline;
// in is the object of BufferedReader
String str = str1.toUpperCase;
for(int i = 0;i<str.length();i++)
{
char ch = str.charAt(i);
if(ch=='A' || ch=='E' || ch=='I' || ch=='O' || ch=='U')
{
str.replace(ch , '*');
}
}
//end of main
//end of class
Answered by aishanimallick470
4

Answer

The program will replace all the vowels with asterisk present in it

Like if this answer is helpful

Attachments:
Similar questions