package codsstore; import java.util.*; /** * @author Sameera Jayasekara */ public class ToArray { public static void main(String[] args) { List<Integer> myList = new ArrayList<Integer>(); myList.add(1); myList.add(2); myList.add(3); Integer[] myArray = new Integer[myList.size()]; myArray = myList.toArray(myArray); for (int x : myArray) { System.out.println(x); } } }
Convert Arraylist to array in Java
Simple code to convert Arraylist to array.
Subscribe to:
Post Comments (Atom)
Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
ReplyDeletePython Training in electronic city
DataScience with Python Training in electronic city
AWS Training in electronic city
Big Data Hadoop Training in electronic city
Devops Training in electronic city
blockchain Training in electronic city
Hibernate Training in electronic city