Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 8 of 8

Thread: Reverse String

  1. #1
    Junior Member
    Join Date
    Jul 2011
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Reverse String

    Hello,
    guys i need help to reverse this string
    using basic method
    i'm just a beginner in java

    this is my code:
    IT SHOULD SKIP COMMAS (,) AND FULLSTOP (.)
    Last edited by WantHelp; July 4th, 2011 at 01:49 PM.


  2. #2
    Junior Member
    Join Date
    Jul 2011
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Reverse String

    I USE ECLIPSE

  3. #3
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: Reverse String

    What are your problems? Errors? Then copy and paste the full and exact error messages. Incorrect behaviour? Then explain what your code does and what it should do instead.

    One problem I can see, if you want to compare Strings (and other objects) 99% of the time you want to use the equals method and not ==.

  4. #4
    Junior Member
    Join Date
    Jul 2011
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Reverse String

    I DID IT !!

  5. #5
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,895
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: Reverse String

    Quote Originally Posted by WantHelp View Post
    I DID IT !!
    ... do you mean your problem is solved?

    Fyi, typing in all-caps usually implies "shouting", and can cause people to mis-interpret what you mean.

  6. #6
    Junior Member
    Join Date
    Jul 2011
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Reverse String

    Yes i did it and i reversed it

  7. #7
    Forum old-timer
    Join Date
    Nov 2008
    Location
    Faversham, Kent, UK
    Posts
    472
    My Mood
    Mellow
    Thanks
    4
    Thanked 58 Times in 54 Posts

    Default Re: Reverse String

    Just for fun:
    String foo = "bar";
    foo = new StringBuilder(foo).reverse().toString();

  8. #8
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: Reverse String

    Please stop removing your code.
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

Similar Threads

  1. How to reverse a string, skiping numbers , and ' ?
    By mlotfi in forum Algorithms & Recursion
    Replies: 2
    Last Post: May 26th, 2011, 05:13 AM
  2. Reverse Number guessing game
    By rarman555 in forum What's Wrong With My Code?
    Replies: 5
    Last Post: April 23rd, 2011, 10:39 PM
  3. Reverse Random Number Game
    By koryvandell in forum Java Theory & Questions
    Replies: 2
    Last Post: April 4th, 2011, 01:11 AM
  4. Reverse Number
    By java1 in forum Java Theory & Questions
    Replies: 2
    Last Post: October 28th, 2009, 10:19 AM
  5. How to reverse a String using java.lang.StringBuilder
    By JavaPF in forum Java SE API Tutorials
    Replies: 0
    Last Post: July 22nd, 2009, 09:42 AM