In this project, file handling is done using Java programming language. Creating, appending and clearing of a text file is done.
1. Java JDK should be installed in your PC. Here are some videos which might help for downloading and installation:
2. A code editor to write the java code. Here are 2 great editors for java: Visual Studio Code and Eclipse.
VS Code: Windows or Ubuntu or Mac
Eclipse: Windows or Ubuntu or Mac
In this code, file handling is done using java. Input from user is taken and saved into a text file. BufferedReader and PrintWriter classes are used. Name, age, address and phone number are taken as input from the user and saved in the text file. Records can be added and displayed using the addRecords() and readRecords() user defined functions. clear() is a user defined function to clear all the records present in the file.
For now, the records saved in the file are: name, age, address and phone number, but you may change that and save any type of data in the file.
The name of the file which is being created is myFile but you can change the file name to anything of your choice. Although make sure you change the file name at all the 3 (currently) required places.
Submitted by Rasika Deshpande (RasikaDeshpande24)
Download packets of source code on Coders Packet
Comments