@@ -0,0 +1,1973 @@
+package java_problems.introduction;%0D%0A%0D%0Aimport java.util.Scanner;%0D%0A%0D%0A/*%0D%0A * Problem Statement: %0D%0A * Static initialization blocks are executed when the class is loaded, and you%0D%0A * can initialize static variables in those blocks.%0D%0A * %0D%0A * It's time to test your knowledge of Static initialization blocks.%0D%0A * %0D%0A * You are given a class Solution with a main method. Complete the given code so%0D%0A * that it outputs the area of a parallelogram with breadth B and height H. You%0D%0A * should read the variables from the standard input.%0D%0A * %0D%0A * If B %3C= 0 or H %3C= 0, the output should be%0D%0A * %22java.lang.Exception: Breadth and height must be positive%22 without quotes.%0D%0A * %0D%0A * Input Format: %0D%0A * There are two lines of input. The first line contains B: the breadth of the%0D%0A * parallelogram. The next line contains H: the height of the parallelogram.%0D%0A * %0D%0A * Constraints:%0D%0A * -100 %3C= B %3C= 100%0D%0A * -100 %3C= H %3C= 100%0D%0A * %0D%0A * Output Format: %0D%0A * If both values are greater than zero, then the main method must output the%0D%0A * area of the parallelogram. Otherwise, print%0D%0A * %22java.lang.Exception: Breadth and height must be positive%22 without quotes.%0D%0A * %0D%0A * Sample input 1: %0D%0A * 1%0D%0A * 3%0D%0A * %0D%0A * Sample output 1: %0D%0A * 3%0D%0A * %0D%0A * Sample input 2: %0D%0A * -1%0D%0A * 2%0D%0A * %0D%0A * Sample output 2: %0D%0A * java.lang.Exception: Breadth and height must be positive%0D%0A */%0D%0Apublic class JavaStaticInitializerBlock %7B%0D%0A%0D%0A    private static int B;%0D%0A    private static int H;%0D%0A    private static boolean flag;%0D%0A%0D%0A    static %7B%0D%0A        %0D%0A        Scanner sc = new Scanner(System.in);%0D%0A        B = sc.nextInt();%0D%0A        H = sc.nextInt();%0D%0A        %0D%0A        if (B %3C= 0 %7C%7C H %3C= 0) %7B%0D%0A            System.out.println(%22java.lang.Exception: Breadth and height must be positive%22);%0D%0A        %7D else %7B%0D%0A            flag = true;%0D%0A        %7D%0D%0A        sc.close();%0D%0A    %7D%0D%0A%09%0D%0A%09public static void main(String%5B%5D args) %7B%0D%0A%09%09%0D%0A%09%09if (flag) %7B%0D%0A%09%09%09int area = B * H;%0D%0A%09%09%09System.out.print(area);%0D%0A%09%09%7D%0D%0A%09%7D // end of main%0D%0A%7D // end of class%0D%0A

Add JavaStaticInitializerBlock