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 1 of 1

Thread: How to reverse a String using java.lang.StringBuilder

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

    Post How to reverse a String using java.lang.StringBuilder

    With this code we can reverse a String using the java.lang.StringBuilder.

    /**
     * JavaProgrammingForums.com
     */
    public class ReverseString {
     
        public static void main(String[] args){
     
              final StringBuilder stringBuilder = new StringBuilder("Java");
              System.out.println(stringBuilder.reverse());
        }
    }

    Output:

    avaJ
    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.

    Looking for a Java job? Visit - Java Programming Careers

  2. The Following User Says Thank You to JavaPF For This Useful Post:

    Json (July 23rd, 2009)


Similar Threads

  1. Replies: 16
    Last Post: August 27th, 2010, 03:30 PM
  2. Conversion of string into integer in Java
    By JavaPF in forum Java Programming Tutorials
    Replies: 17
    Last Post: January 23rd, 2010, 08:33 AM
  3. Replies: 5
    Last Post: May 21st, 2009, 02:45 AM
  4. [SOLVED] How to string a decimal number in Java?
    By Lizard in forum Loops & Control Statements
    Replies: 6
    Last Post: May 14th, 2009, 03:59 PM
  5. [SOLVED] Facing java error "cannot be applied to (java.lang.String)"
    By tazjaime in forum What's Wrong With My Code?
    Replies: 1
    Last Post: April 23rd, 2009, 10:19 AM

Tags for this Thread