answersLogoWhite

0

If you want to do it neat and effortless, you may use enums.

public class MyClass {

private enum VOWELS { A,E,I,O,U,a,e,i,o,u; }

public static void main(String []ar) {

String s = "Hello World";

for(VOWELS c : VOWELS.values())

s = s.replace(c.name(), "*");

System.out.println(s);

}

}

.

Ram

User Avatar

Wiki User

9y ago

Still curious? Ask our experts.

Chat with our AI personalities

JordanJordan
Looking for a career mentor? I've seen my fair share of shake-ups.
Chat with Jordan
CoachCoach
Success isn't just about winning—it's about vision, patience, and playing the long game.
Chat with Coach
RossRoss
Every question is just a happy little opportunity.
Chat with Ross

Add your answer:

Earn +20 pts
Q: How do you replace a vowel into asterisk using java program loops?
Write your answer...
Submit
Still have questions?
magnify glass
imp