Come primo esercizio sui file penso di avere fatto un bel casino...![]()
Severity Description Resource In Folder Location Creation Timecodice:import java.io.*; public class EsFile { File file1, file2, file3; FileInputStream oldMaster, Transaction; FileOutputStream newMaster; ObjectInputStream inOldMaster, inTransaction; ObjectOutputStream outNewMaster; RecordFile recordMast, writeMast; Record2File recordTans; public EsFile() { super(); file1 = new File("D:\\Programmazione\\java\\EsFile\\oldmast.dat"); file2 = new File("trans.dat"); file3 = new File("newmast.dast"); oldMaster = new FileInputStream(file1); //Riga 20 Transaction = new FileInputStream(file2); //Riga 21 newMaster = new FileOutputStream(file3); inOldMaster = new ObjectInputStream(oldMaster); inTransaction = new ObjectInputStream(Transaction); outNewMaster = new ObjectOutputStream(newMaster); recordMast = new RecordFile(); recordTans = new Record2File(); } public static void main(String[] args) { try { while ( true ) { recordMast = (RecordFile) inOldMaster.readObject(); } } catch (EOFException eofException) { closeFile(); } try { while ( true ) { recordTrans = (Record2File) inOldMaster.readObject(); } } catch (EOFException eofException) { closeFile(); } writeMast = new RecordFile(5, "Federico", 5000.5); outNewMaster.write(writeMast); return 0; } }
2 Unhandled exception type FileNotFoundException EsFile.java EsFile line 20
2 Unhandled exception type FileNotFoundException EsFile.java EsFile line 21
2 Unhandled exception type FileNotFoundException EsFile.java EsFile line 22
2 Unhandled exception type IOException EsFile.java EsFile line 23
2 Unhandled exception type IOException EsFile.java EsFile line 24
2 Unhandled exception type IOException EsFile.java EsFile line 25
2 Cannot make a static reference to the non-static field inOldMaster EsFile.java EsFile line 36
2 Cannot make a static reference to the non-static field recordMast EsFile.java EsFile line 36
2 The method closeFile() is undefined for the type EsFile EsFile.java EsFile line 40
2 Cannot make a static reference to the non-static field inOldMaster EsFile.java EsFile line 46
2 recordTrans cannot be resolved EsFile.java EsFile line 46
2 The method closeFile() is undefined for the type EsFile EsFile.java EsFile line 50
2 Cannot make a static reference to the non-static field writeMast EsFile.java EsFile line 53
2 Cannot make a static reference to the non-static field outNewMaster EsFile.java EsFile line 54
2 Cannot make a static reference to the non-static field writeMast EsFile.java EsFile line 54
2 Void methods cannot return a value EsFile.java EsFile line 56
1 The serializable class Record2File does not declare a static final serialVersionUID field of type long Record2File.java EsFile line 4
1 The serializable class RecordFile does not declare a static final serialVersionUID field of type long RecordFile.java EsFile line 4

Rispondi quotando