Hello everybody, I have an application here which takes the choice from a user and does the necessary processing. I am using text files for this. The following are the three programs: 1. Employee1.java 2. Employee1App.java 3. Employee2.java I had a couple of doubts: 1. Employee1App has the main method. Choice3 takes us to Employee2 file which checks if an employee exists. the program is working but it is also printing the catch part of the try-catch statement even after it has successfully executed the try part. 2. Is there a way to delete a record ..... just like we have readLine() is there a way tp delete a line.
Hi, The possible reason could be because of the readLine() method because after all the records from the text file are read finally the end of file is reached and then the readLine() throws the IOException because there is no more input to read thats the reason I think after u get the out put successfully the catch() part is getting executed. Please check and let me know.. All the best, Gaya3 ------------------------------------------------- "Life is a process of Continuous learning"
Hint: delete the line (containing the matching record) from the file and write the remaining contents to the same file. So you need something to hold the contents of the file. You have various options (String, Array of Strings ...)
<a href="http://www.mqtips.com" target="_blank" rel="nofollow">MQMessenger</a> - free Java app for MQSeries