Hey guys, I'd first just like to thank in advance for anyone taking the time to help out. Basically, I'm working on a project, and what I have to do is make a class that descends from exception, and make another class that throws that particular exception. In the constructor, I'm supposed to check to make sure that the idNumber is valid, and if not I'm supposed to throw the exception. If anyone can help out or give me a few tips that'd be great! Thanks again
P.S the error I'm getting with what I currently have is on the line that says "catch(IdNumberException)" and it is saying "illegal start of type ';' expected"
public abstract class Student { private String name; private int idNumber; public Student(int id, String stName) { name = stName; idNumber = id; if(idNumber < 1 && idNumber > 9999) throw new IdNumberException(); } catch(IdNumberException e) { System.out.println(e.getMessage()); } public String toString() { return("Name: " + name + " ID Number: " + idNumber); } }public class IdNumberException extends Exception { public IdNumberException() { super("Invalid ID Number"); } public IdNumberException(String message) { super(message); } }