2

Below code convert Array List to array and store result as type object.How can I convert it into a specific type like array of Strings.

   List<String> list = new ArrayList<>();
 list.add("Blobbo");
 list.add("Cracked");
 list.add("Dumbo");
 Object[] ol = list.toArray();
0

1 Answer 1

2

Use this:

String[] ol = list.toArray(new String[0]);
Sign up to request clarification or add additional context in comments.

2 Comments

You did see that the question is flaged as a duplicate?
Ooh yes, I have seen it. ^^

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.