Posts

File Handling in JAVA!!

Image
File Handling in Java! File handling is an essential part of any programming language. Using files, a program can store data on a storage device. To perform various actions on a file, such as read, write, and so on, file handling is required. File handling is defined as reading from a file and writing to a file. We can use the File class in JAVA  to create a file object. The package java.io contains a File class to work and handle different formats of files. If you want to use the File class, you need to create an object of the File class and provide the name of the file or pathname. Using file class we can access metadata of files such as file name, file size, permissions, type of file, etc. What is a Stream in Java? A stream is a sequence of data. It is also defined as a sequence of bytes. It can be used to represent either an input source or a destination. The source and destination can be disk files, arrays, text files, etc. The input stream reads or retrieves data fr...