I have created an ArrayList of Object and it contains both Integer and String.
List<Object> arrayList = new ArrayList<>();
Using the below condition I have checked whether it is integer or not
if(arrayList.get(indexValue) instanceof Integer){
// Here how convert the object into integer
}
But the problem is, how can I convert the object into integer ?
Thanks
You can explicitly cast it to Integer but dont need Java does does it for you.