Program: Java FILE INPUT-OUTPUT Concept Summary: 1. File Handling 2. Exception handling Description Write a program that reads two files and compares the contents of
Program: Java
FILE INPUT-OUTPUT
Concept Summary:
1. File Handling
2. Exception handling
Description Write a program that reads two files and compares the contents of the file.
Design the program that reads two files and compares their contents.
The program calls a method that reads the file one line at a time. If the lines are the same the program skips the line. If the lines are different then the program prints the line number followed by the different lines from each file. The program checks to see if the files have the same number of lines. If the files do not have an equal number of lines, it should throw an error such as \"NOT ENOUGH DATA\". The program should also throw an error if the program cannot find the file or open it.
SAMPLE OUTPUT:
Line 1
> Humpty Dumpty tat on a wall Line 3
> All the kings horss and all the kings men
Step by Step Solution
There are 3 Steps involved in it
Step: 1
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started