public static void main(String[] args) throws IOException {
String token1 = "";
Scanner inFile = new Scanner(new File(filename));
List<String> temps = new LinkedList<String>();
while (inFile.hasNext()) {
token1 = inFile.next();
temps.add(token1);
}
inFile.close();
String[] tempsArray = temps.toArray(new String[0]);
for (String hole : tempsArray) {
System.out.println(hole);
}
I read my file to array, but to continue I need to convert this array to char array. Thanks in advance.
StringintempsArray:tempArrayString.toCharArray();. Now, why would you need to convert it tochar[]?["hello", "world"]. What would you want to transform it to?