Conversion of Integer Arraylist to string
12,413
If numbers[i]
is of type Integer
you can just use its built in toString()
method. However, as numbers
is an ArrayList
, you need to use numbers.get(i)
.
String numbersString[i] = ...
is invalid syntax. You have to declare your array outside the loop and then access it simply by numbersString[i] = ...
inside the loop.
Author by
Admin
Updated on June 04, 2022Comments
-
Admin almost 2 years
I'm trying to convert the numbers of my Array list into Strings at point i. How do I do this so I can create substrings of my numbers?
ArrayList<Integer> numbers= new ArrayList<Integer>(); for( int i=0; i<=10; i++){ String numbersString[i] = String.valueOf(numbers[i]); }
-
Алексей about 10 yearsthe question such as > what is it you are trying to accomplish? should be part of the comment rather then an answer