¿¹Á¦

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

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

}


¼Ö·ç¼Ç
catch ÀýÀÇ ±â´É¼ºÀ» Àç°ËÅäÇϰí, java.util.NoSuchElementExceptionÀÌ ¿À·ù¿¡¼­ 󸮵Ǿú´ÂÁö È®ÀÎÇϽʽÿÀ.


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

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