You are on page 1of 7

JAVA ASSIGNMENT (JAVA STREAM)

Name - Chirag Rathi Reg. No. - 21BCE10255

1. Write a Java program that utilizes FileOutputStream to create a new file and writes the
binary representation of the numbers 1 to 10 into the file.
2. Write a Java program that reads a text file using FileReader and counts the occurrences
of the letter 'a' in the file.

3. Write a Java program that reads a text file using FileReader and counts the number of
vowels (a, e, i, o, u) present in the file.
4. Write a Java program that uses FileWriter to create a new text file and write three
sentences into the file, ensuring that each sentence appears on a new line.

5. Write a Java program that reads a text file using BufferedReader and displays each
line on the console. Handle any IOExceptions that may occur.
6. Write a Java program that uses BufferedWriter to write a poem or any text of your
choice into a file. Ensure that each line of the poem is written on a new line in the
file.
7. Write a Java program that uses both byte-oriented and character-oriented streams
to copy the contents of a binary file to a text file. Also, handle any IOException that
might occur during the file copy operation. Implement appropriate exception
handling.
8. Write a Java program that uses byte-oriented streams to read an image file and
convert the image to grayscale and write the modified image to another new file.
9. Write a Java program that reads a CSV (Comma-Separated Values) file named
using BufferedReader and displays the data in a tabular format on the console.

You might also like