Question: Write a java program that counts the number of lines in a file. After that the user should specify which line to be printed out.

Write a java program that counts the number of lines in a file. After that the user should specify which line to be printed out. You have to check if the user has chosen a valid line number.For example if the user choose line 0 a message should printed as You Do not want to read any line from the file. In addition if the user choose a line number that is greater than total number of line a message should be printed The line number is not valid out of bound. Below sample of the results. Write a java program that counts the number of lines in

Input: nput-Notepad File Edit Format View Help Java is a core code langauge for Computer Engineering Students. Be happy. Result: terminated tJava Application] C Program File le a jnela .181 bin The number of lines in the file is 3 vaw.exe (Oct 4, 2018 4:47 36 PM) Enter nunber the line you need to be read from the file: 2 The required line is Engineering Students.

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!