In this tutorials, we are going write a Java Program For Triangle Part 1 to create a below. This is a Part 1  of the complete example. You can follow the complete 4 parts to complete the entire example.

Java Program for Triangle Part 1 :

package com.onlinetutorialspoint.patterns;

import java.util.Scanner;

/*    j    
 * i  *****
 *     ****
 *      ***
 *       **
 *        *
 */
public class Triangle_Down_LeftToRight {
    public static void main(String args[]) {
        /* Getting the input from keyboard */
        Scanner scanner = new Scanner(System.in);
        System.out.println("Enter the size of Triangle..");
        int size = scanner.nextInt();
        for (int i = 1; i <= size; i++) {
            for (int j = 1; j <= size; j++) {
                if (j < i) {
                    System.out.print(" ");
                } else {
                    System.out.print("*");
                }
            }
            System.out.println();
        }
    }
}

By running the above Java program, you can get the below shape.

Output :

Java Program for Triangle

Happy Learning 🙂