Hey everyone, please lend me help understanding in line 7 why should i turn arr.get(indx) to String, If it already returns String, since get() method of ArrayList returns String of an index, thanks a million .
By calling toString() on that Object you will get a textual representation of the object. Really depends on the object and if it implements the toString method or not.
Hey Aladdin Raul ,
Ronald Castillo is correct, arr.get returns an Object and label's setText expects a String, so there is a type mismatch. Hence it is necessary to use toString.
I guess you could use generics to your advantage to avoid toString. For instance
would work fine. Give it a try.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.