Inverted Right Triangle Star Pattern
Print an inverted right-angled triangle star pattern in Java.
Last updated: 11 January 2026
Method 1: Using Nested Loops
Decreasing star count.
Main.javaRun in Compiler →
public class InvertedTriangle {
public static void main(String[] args) {
int rows = 5;
for (int i = rows; i >= 1; --i) {
for (int j = 1; j <= i; ++j) {
System.out.print("* ");
}
System.out.println();
}
}
}Output:
* * * * * * * * * * * * * * *
Explanation
Outer loop runs from n to 1. Inner loop prints i stars.
Frequently Asked Questions
Try This Program
Copy this code and run it in our free online Java compiler.
Open Java Compiler