JAVA program checking programming homework help
These are the tasks I was required to code and I did. However, I do not know how to open the file that the professor is talking about and are these codes are correct according to what I am required to ?
Q3) Write a program that asks the user for the name of a file. The program should display only the first five lines of the file’s contents. If the file contains less than five lines, it should display the file’s entire contents.
Q4) Write a program that asks the user for the name of a file. The program should display the contents of the file with each line preceded with a line number followed by a colon. The line numbering should start at 1.
Please see attached my codes