How do you write a method that has "throws IllegalArgumentEception" in the method declaration. Such like this one: If I were to only return d if d>0 otherwise throw an IllegalArgumentException
, how would I do that? Do you use try{}
and catch{}
?
public double getPrice(double d) throws IllegalArgumentException {
}