Types of Nested Loops in JAVA
- by dominoos
Hi guys. I have a simple question. I have to find out many nested loops as possible in java. I have something like for loop and if statement inside. i know that we can do like if{if{if{if{ something like that too. just need some more idea of more types of nested loops.
if you can write down some examples. I'll be very glad. thank you.
public class Test {
public static void main (String []args) {
int i = 0;
for(int j = 1; j <= 5; j++) {
if(j == 1 || j == 5) {
i = 4;
}
else {
i = 1;
}
for(int x = 0; x < i; x++) {
System.out.print("**");
}
System.out.println();
}
}
}