Question: This is for Java. Q1) Write a program that opens a file named Numberlist.txt; then uses a loop to write the numbers 1 through 100

This is for Java.
Q1) Write a program that opens a file named Numberlist.txt; then uses a loop to write the numbers 1 through 100 to the file. Q2) Write a program that reads numbers from the Numberlist.txt file (the one you created above), finds their sum and displays it. 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.. Add input validation to make sure the file name given by the user exists. 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. Add input validation to make sure the file name given by the user exists
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
