Baklava in Java

Published on 28 April 2022 (Updated: 05 February 2023)

Baklava in Java

Welcome to the Baklava in Java page! Here, you’ll find the source code for this program as well as a description of how the program works.

Current Solution

public class Baklava {
    public static void up() {
        for (int i = 0; i < 10; i++)
            printRow(i);
    }

    public static void down() {
        for (int i = 10; i >= 0; i--)
            printRow(i);
    }

    public static void printRow(int rowNum) {
        for (int j = 10 - rowNum; j > 0; j--)
            System.out.print(" ");
        for (int j = 0; j <= rowNum * 2; j++)
            System.out.print("*");
        System.out.println();
    }

    public static void main(String[] args) {
        up();
        down();
    }
}

Baklava in Java was written by:

If you see anything you’d like to change or update, please consider contributing.

Note: The solution shown above is the current solution in the Sample Programs repository as of Oct 10 2022 15:04:56. The solution was first committed on Dec 30 2018 18:01:26. As a result, documentation below may be outdated.

How to Implement the Solution

No ‘How to Implement the Solution’ section available. Please consider contributing.

How to Run the Solution

No ‘How to Run the Solution’ section available. Please consider contributing.