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
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
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
4
Answer
The program will replace all the vowels with asterisk present in it
Like if this answer is helpful
Attachments:
Similar questions