Hey, im getting the following error
unreported exception Exceptions.IllegalValue; must be caught or declared to be thrown
this is my method where im getting the error and i want to know why im getting this error because i declared that the exception was to be thrown.
is it something to do with my if and else statements and where the brackets are located??
any suggestions greatly appreciated :)
/**
* adds an object to the front of the queue
* @param Object e, int p the object to add and the priority respectively
* @exception IllegalValue if the priority number is less than 0
*/
public void enqueue(Object e, int p) throws IllegalValue{
if(p > 0) {
Iterator it = this.iterator();
if (isEmpty() || p > front.priority) {
front = new Link(e,p,front);
} else {
Link temp = (Link)it.next();
while (it.hasNext() && temp.priority >= p) {
it.next();
}
temp = new Link(e,p,temp);
}
}else throw new IllegalValue("illegal priority value");
}