You are viewing a single comment's thread. Return to all comments →
private String message; Solution(String message) { this.message=message; } @Override public String getMessage() { return message; }
public static void main(String[] args) { Scanner sc=new Scanner(System.in); int b=sc.nextInt(); sc.nextLine(); int h=sc.nextInt(); sc.close(); if(b>0 && h>0) { System.out.println(b*h); } else { try{ throw new Solution("java.lang.Exception: Breadth and height must be positive"); } catch(Exception e){ System.out.println(e.getMessage()); } } }
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 →
private String message; Solution(String message) { this.message=message; } @Override public String getMessage() { return message; }