Is there a mechanism for storing the data of a .txt
file in a LinkedList? For example, how would this list have the Strings "Caio", "Peter" and "Luiza" as elements?
import java.io.*;
public class teste {
public static void main ( String args [] ) throws IOException {
LinkedList<String> linkedlist = new LinkedList<String>(); /*lista de Strings*/
File arquivo = new File("C:\NetBeans\teste.txt");
arquivo.createNewFile();
FileWriter fw = new FileWriter(arquivo, true);
BufferedWriter bw = new BufferedWriter(fw);
bw.write("Caio Pedro Luiza");
bw.close();
fw.close();
}
}