I have to read from a file Author|Name|Year I need to store this information into class nodes. I must use BufferedReader and FileReader.
public class Book {
String author, name;
int years;
}
import java.io.FileReader;
import java.io.BufferedReader;
import java.io.IOException;
public class Main {
public static void main(String[] args) throws Exception{
Book book1 = new Book();
FileReader file = new FileReader("C:/Users/ZatoIndustries/Desktop/failas.txt");
BufferedReader reader = new BufferedReader(file);
String text = "";
String line = reader.readLine();
}
}
Input looks like:A|bbbb|2002 B|cccc|2001 A|dddd|2000
Aucun commentaire:
Enregistrer un commentaire