You are viewing a single comment's thread. Return to all comments →
import java.io.; import java.util.; class soln{ static{ Scanner ob=new Scanner(System.in); int B=ob.nextInt(); int H=ob.nextInt(); int area=B*H;
if(H<=0 || B<=0) System.out.println("java.lang.Exception: Breadth and height must be positive"); else System.out.println(area); } }
public class Solution { public static void main(String[] args) { soln ob1= new soln();
} }
Seems like cookies are disabled on this browser, please enable them to open this website
Java Static Initializer Block
You are viewing a single comment's thread. Return to all comments →
import java.io.; import java.util.; class soln{ static{ Scanner ob=new Scanner(System.in); int B=ob.nextInt(); int H=ob.nextInt(); int area=B*H;
public class Solution { public static void main(String[] args) { soln ob1= new soln();
} }