Question: In JAVA how do you open the file reading in each line as a String, store each String in an ArrayList. - If a FileNotFoundException

In JAVA how do you open the file reading in each line as a String, store each String in an ArrayList. - If a FileNotFoundException is thrown catch the exception and alert the user of the error. Find the alphabetic character that occurs the most in each sentence in the file, only consider alphabetic characters, treat lowercase and uppercase as the same character - For example if the input is "Hi how are you" the character H occurs twice - Assume that one alphabetic character will repeat more than the others - The sentence will only have one alphabetic mode. - Use the method findMode

(The main method cannot be set to throw any exceptions. The text file will contain multiple lines and each line will correspond to a single sentence.)

Sample Output:

Ex: If input is: anexample.txt

the output is:

Please enter the name of the file: The Character 0 occurs 5 times. The Character I occurs 5 times.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!