File Input and Output
File Input and Output
2.) The example code will read and write from a file in the user's home directory to prevent any
misunderstanding about the file route. System.getProperty("user.home"); returns the user's home
directory, which is what we use throughout our examples.
Name: Mark Ven Lambot Date: May 20, 2021
Year and Section: BSIS 2-D Contact Number: 09109701217
3.) A Random Access file functions similarly to a wide array of bytes in the file system. The file
pointer is a type of cursor or index into the implied array; input operations read bytes beginning at
the file pointer and advance the file pointer past the bytes read.
4.) Ordinary Files – Ordinary files are used to store data such as text, graphics, and images. The
information fed by the user is saved in these folders. Ordinary files include notepads, paint
programs, programming applications, and so on.
Directory Files – Directory files are simply a place/area/location where file information is stored.
It includes information such as file names, ownership, file size, and the date and time they were
created and last modified.
5.) The Path Class – A path in the file system is represented programmatically by the Path class. A
Path object is used to inspect, locate, and manipulate files. It contains the file name and directory
list used to create the path.
The code snippet below creates a Path instance and then calls multiple methods to get details
about it:
C:\home\joe\foo