View the step-by-step solution to:

I need some java help. How would I accomplish this in Java?

I need some java help. How would I accomplish this in Java?


Problem1:


Write a program that reads each line in a file, reverses its lines, and writes them to another file. For example, if the file data.txt contains the lines:


Mary had a little lamb


Its fleece was white as snow


And everywhere that Mary went


The lamb was sure to go.



The file output.txt contains:


The lamb was sure to go.


And everywhere that Mary went


Its fleece was white as snow


Mary had a little lamb

Top Answer

import java.io.*; import java.util.*;    public class reverse{ public static void main(String[] args) throws IOException {... View the full answer

Sign up to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Ask a homework question - tutors are online