Java : File Handling - Exercises and Solution


1. Write a java program to Create a new file

View Solution

2. Write a java program to Read a file line by line

View Solution

3. Write a java program to Get file size and file path

View Solution

4. Write a java program to Check whether a file can be read or not

View Solution

5. Write a java program to Delete a file

View Solution

6. Write a java program to Copy files

View Solution

7. Write a java program to Get the last modification date and time of a file

View Solution

8. Write a java program to Append text or string in a file

View Solution

9. Write a java program to Get the file's owner name

View Solution

10. Write a java program to Get the attributes of a file

View Solution

11. Write a java program to Rename an existing file

View Solution

12. Write a java program to get file creation, last access and last modification time

View Solution

13. Write a java program to Read content from file using BufferedReader

View Solution

14. Write a java program to Check file is Hidden or Not

View Solution

15. Write a java program to determine number of bytes written to file using DataOutputStream

View Solution

16. Write a java program to Get the size of give file in bytes, kilobytes and megabytes

View Solution

17. Write a java program to Create directory or folder in particular drive

View Solution

18. Write a java program to Print File Content and Display File

View Solution

19. Write a java program to Get the basic file attributes

View Solution

20. Write a java program to Read text from file from a specified index or skipping byte using FileInputStream

View Solution

21. Write a Java program to find the longest word in a text file

View Solution

22. Write a Java program to read first Three lines from a file

View Solution

23. Write a Java program to write and read a plain text file

View Solution

24. Write a Java program to store text file content line by line into an array

View Solution

25. Write a java program to read a file line by line and store it into a variable

View Solution




Basic Programs