hi:
you can do that like that is
package com.structure;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class TestArray {
static List<String> list = new ArrayList<String>();
// static Object[] state;
public static void main(String agrs[]) {
Scanner scan = new Scanner(System.in);
System.out.println("Please input number:");
int num = scan.nextInt();
System.out.println("Please input your String:");
for (int i = 0; i < num; i++) {
list.add((String) scan.next());
}
for (Object str : exchangeArray(list)) {
System.out.println(str);
}
}
public static Object[] exchangeArray(List list) {
return list.toArray();
}
}
Ezzaral commented: No code tags. Example does little to demonstrate the question. +0
iamthwee commented: Get a life, do your own homework! -2
~s.o.s~ commented: Please be more descriptive and post code using code tags. +24
peter_budo commented: Pointles on comenting somebody else corect solution. Please use full sentences next time. -1