import?
java.util.Enumeration;
class? collection? implements? Enumeration? {
?? private? int? count?=? 0 ;
?? private? boolean? more?=? true ;
?? public? boolean? hasMoreElements ()?{
???? return? more;
?? }
?? public? Object?nextElement ()?{
???? count++;
???? if? ( count?>? 4 )
?????? more?=? false ;
???? return?new? Integer ( count ) ;
?? }
}
public?class? MainClass? {
?? public?static? void? main ( String?args [])?{
???? Enumeration?e?=? new? collection () ;
???? while? ( e.hasMoreElements ())?{
?????? System.out.println ( e.nextElement ()) ;
???? }
?? }
}
class? collection? implements? Enumeration? {
?? private? int? count?=? 0 ;
?? private? boolean? more?=? true ;
?? public? boolean? hasMoreElements ()?{
???? return? more;
?? }
?? public? Object?nextElement ()?{
???? count++;
???? if? ( count?>? 4 )
?????? more?=? false ;
???? return?new? Integer ( count ) ;
?? }
}
public?class? MainClass? {
?? public?static? void? main ( String?args [])?{
???? Enumeration?e?=? new? collection () ;
???? while? ( e.hasMoreElements ())?{
?????? System.out.println ( e.nextElement ()) ;
???? }
?? }
}