Results 1 to 4 of 4
Like Tree1Likes
  • 1 Post By Vinod Mukundan

Thread: Writing a program that replaces each line of a file with its reverse.

  1. #1
    stewart1 is offline Member
    Join Date
    Jan 2012
    Posts
    1
    Rep Power
    0

    Default Writing a program that replaces each line of a file with its reverse.

    Write a program that replaces each line of a file with its reverse. For example, if you run

    java Reverse HelloPrinter.java
    then the contents of HelloPrinter.java are changed to

    retnirPolleH ssalc cilbup
    {
    )sgra ][gnirtS(niam diov citats cilbup
    {
    wodniw elosnoc eht ni gniteerg a yalpsiD

    ;)"!dlroW, olleH"(nltnirp.tuo.metsyS
    }
    }
    Of course, if you run Reverse twice on the same file, you get back the original file.

  2. #2
    Join Date
    Jul 2010
    Location
    India
    Posts
    58
    Rep Power
    0

    Default Re: Writing a program that replaces each line of a file with its reverse.

    Well so how far you have tried ? Post your tries and you can find help here.


    warm regards
    Vinod M
    Tolls likes this.
    _______________________________________________
    give me beans .........

  3. #3
    vinci123 is offline Member
    Join Date
    Aug 2011
    Location
    INDIA
    Posts
    64
    Rep Power
    0

    Default Re: Writing a program that replaces each line of a file with its reverse.

    store the data in an array and call reverse () method on it may works .
    I can and I will

  4. #4
    vinci123 is offline Member
    Join Date
    Aug 2011
    Location
    INDIA
    Posts
    64
    Rep Power
    0

    Default Re: Writing a program that replaces each line of a file with its reverse.

    what do you want from - a single line you may enter dynamically and it prints the revers of it ?if so let me know
    I can and I will

Similar Threads

  1. File Writing Issue - Only Writes First Line
    By DragonGhola in forum Advanced Java
    Replies: 4
    Last Post: 07-22-2011, 05:41 PM
  2. Java- Writing a file and reading a file line by line
    By Nazneen Ali in forum New To Java
    Replies: 7
    Last Post: 07-20-2011, 08:56 AM
  3. Replies: 8
    Last Post: 07-17-2011, 03:38 PM
  4. Replies: 14
    Last Post: 04-26-2011, 03:18 AM
  5. Replies: 8
    Last Post: 12-28-2010, 03:24 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •