Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

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

blur-text-image
Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

App Inventor

Authors: David Wolber, Hal Abelson

1st Edition

1449397484, 9781449397487

More Books

Students explore these related Programming questions