// For loop pattern
public class NestedFor {
public static void main(String[] args) {
for (int i = 0; i < 5; i++) {
for (int j = 0; j <= i; j++) {
System.out.print("* ");
}
System.out.println();
}
}
}
Output:*
* *
* * *
* * * *
* * * * *
// For loop pattern
public class NestedFor {
public static void main(String[] args) {
for (int i = 0; i < 5; i++) {
for (int j = 0; j <= i; j++) {
System.out.print("* ");
}
System.out.println();
}
}
}
Output:*
* *
* * *
* * * *
* * * * *
Java Program to convert days into Year, Month, Day
Java String compareTo() Example Code
Arithmetic Operators Examples In Java
Program to explain Generic class with Bounded type in Java
Declare variable at the end of Java Program
Dynamic Variable Initiazation in Java
Nested try catch block with function example in Java
Program to explain Logical And ( & ) and Logical Short-circuit And ( && ) Operator in Java
Program to use GridLayout in Java
Get Sum of n numbers using For Loop in Java
Program to explain Calling super class constructor using super in Java
Using super keyword to call Overriding Method example in Java
Polymorphism with interface example in Java