Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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.
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
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