Type mismatch: cannot convert from element type Object to Parent

后端 未结 2 1902
轮回少年
轮回少年 2021-01-29 10:03

i\'m trying to develop an e4 application but i have an error : in this part \"error:Type mismatch: cannot convert from element type Object to Parent\" any help please thanks in

2条回答
  •  借酒劲吻你
    2021-01-29 10:32

    change corresponding lines to below code as:

    for(Object p : parentholder.getParents())
          {
              Parent p1= (Parent)p;
               //your code .....
            }
    

    similarily for Child class

     for(Object p : parentholder.getParents())
          {
              Child child= (Parent)p;
               //your code .....
            }
    

提交回复
热议问题