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
Chat with our AI personalities
Loops are very important part of a C-language. If we have to run our programe multiple time then we use Loops of C.
how to print "square" using for loop
There several methods: For/Next loop Do/While/Until loops You can have Do Loops within Do Loops.
* ** *** **** simply use dis... { int x,y; for(x=1;x<=4;x++) { for(y=1;y<=x;y++) printf("*"); printf("\n"); } }
Using case structures becomes difficult when programming multiple alternative decisions. Instead of listing each of the steps and executing them individually, it is easier to make decision structures and loops.