Computer Science, asked by logso8924, 1 year ago

How to cast a list of strings to a string array?

Answers

Answered by sulagna5396
0

 List.toArray()

import java. util. Arrays;import java. util. List;class ListUtil.{// convert list of string to array of string in Java.public static void main(String[] args) {List<String> list = Arrays. asList("NYC", "New Delhi");String[] array = list. toArray(new String[0]);

Similar questions