I'm having a hard time figuring out how to throw and catch exceptions.
I Think I have the general syntax right, at least according to the book that I'm using, but I keep getting errors.
Can anyone help me out with the syntax?
public Movie( String title, int yearReleased, double rating){
try{
if (rating < 4.1 && rating >= 0.0)
this.rating = rating;
else
throw new IllegalArgumentException;
catch (IllegalArgumentException e){
System.out.println("This rating is invalid");
}
}