Computer Science, asked by steffy16, 11 months ago


Write a program in java to accept a string in upper case and replace all the vow
with Asterisk (*) present in the String.
Sample Input : "TATA STEEL IS IN JAMSHEDPUR"
Sample output : T*T* ST**L*S 'N J*MSHEDP*R

Answers

Answered by charlie1505
3

Explanation:

public class VowelswithStar

{

public static void main(String[] args)

{

String string = "TATA STEEL IS IN JAMSHEDPUR"; //Input String

System.out.println("Input String : "+string); //Displaying Input String

string = string.replaceAll("[AaEeIiOoUu]", "*"); //Replace vowels with star

System.out.println(string); //Display the word after replacement

}

}

Similar questions