Question
I need help with a Java assignment Write a program that reads in all lines from a file and saves each to an element in
I need help with a Java assignment
Write a program that reads in all lines from a file and saves each to an element in an array. The program should then print out the lines in reverse.
1. Create a class called Lab8.
2. To break up this problem, first write code that reads in the first line of the file. Use my sample file called haikuFun.txt under the Files tab.
3. When you have this working, modify your code to read in every line of the file. Assume the file will only ever have 6 lines. You should use breakpoint debugging to make sure each line is getting read in properly.
4. Next, modify your code to store each of the 6 lines into an array.
5. Lastly, modify your code to print the lines in reverse order to a file called reverse.txt.
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