Question: I need the answer within 15 minutes Question 3: class StudentException extends Exception { int id; public StudentException (int id) {this.id = id;} @Override public
I need the answer within 15 minutes
Question 3: class StudentException extends Exception { int id; public StudentException (int id) {this.id = id;} @Override public String toString() { return "StudentException, this.id = } " + this.id; public class FinalsQ4 { public static void main(String[] // WRITE CODE HERE args // WRITING CODE ENDS HERE You are given the following code snippet. Write code to take integer input from scanner (console). If input is an odd number, just print Input is odd number. If input is an even number, then throw the above custom exception i.e., StudentException by instantiating it with the input number (However, the program must keep on running). ** If input is your roll number, only then stop the program (i.e., return;). Use try-catch, throw, throws, as necessary
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
