animals[2] = "Dog";
But (according to the compiler) you defined
animals
as a collection of
Animals
, not a collection of strings. So you need to create a new Animal and assign that to your list, like:
Animals newDog = new Animals(1, "Dog");
animals[2] = newDog;