I am new to Java so can someone please explain why are we declaring the variable in such way for Enumeration. I get that some sort of Unboxing is happening here but I am having kind of difficulty understanding this. I am specifically talking about [[ double y=(Double) ]] from the code. Any help is appreciated. Thank you.
import java.util.Enumeration;
import java.util.Vector;
public class EnumarationDemo {
    public static void main(String[] args) {
        
        Vector v  = new Vector();
        for(int i=0; i<=5; i++) {
            v.addElement(i);
        }
                System.out.println(v);  
    
    Enumeration e= v.elements();
    while(e.hasMoreElements()) {
        double y=(Double) e.nextElement();
        if(y%2==0) {
            System.out.println(y);
        }
    }
    
    }
}
 
    