Branching Statements (Labeled Break / Labeled Continue)

PHOTO EMBED

Mon Apr 19 2021 06:50:13 GMT+0000 (Coordinated Universal Time)

Saved by @ahmedqgqgq #java

import java.util.Scanner;

public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        test: {
            if (5 < 6) {
                break test;
            }
            System.out.println("1");
            System.out.println("2");
            System.out.println("3");
            System.out.println("4");
        }
        System.out.println("5");
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        for (int row = 1; row <= 10; row++) {
            for (int column = 1; column <= 5; column++) {
                System.out.print("* ");
            }
            System.out.println("");
        }
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        stop: {
            for (int row = 1; row <= 10; row++) {
                for (int column = 1; column <= 5; column++) {
                    if (row == 5) {
                        break stop;
                    }
                    System.out.print("* ");
                }
                System.out.println("");
            }
        }
    }
}
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        for (int row = 1; row <= 5; row++) {
            System.out.println();
            for (int column = 1; column <= 10; column++) {
                if (column > row) {
                    continue;
                }
                System.out.print("* ");
            }
        }
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        nextRow: for (int row = 1; row <= 5; row++) {
            System.out.println();
            for (int column = 1; column <= 10; column++) {
                if (column > row) {
                    continue nextRow;
                }
                System.out.print("* ");
            }

            System.out.println("Ahmed Abdelmoneim");
        }
    }
}
content_copyCOPY