Example

public static class ClassA implements Iterator {
//Other Iterator methods...
public Object next () {

try {
//...
} catch ( Exception e ) {
// Handle exceptions here
}
}

}


Solution
Reconsider the functionality of the catch clause. Ensure that java.util.NoSuchElementException is thrown on error


public static class ClassA implements Iterator {
//Other Iterator methods...
public Object next() {

try {
//...
} catch ( Exception e ) {
throw new NoSuchElementException();
}
}
return nextObj;
}