Results 1 to 14 of 14
  1. #1
    Giggity is offline Member
    Join Date
    Jan 2013
    Posts
    6
    Rep Power
    0

    Default How to reverse a string in Java without using SubString

    Hi all, I am new to these and really need some help.
    Could someone please explain the methods and how to reverse a Java string without using a SubString.
    Thanks in advance

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,702
    Rep Power
    8

    Default Re: How to reverse a string in Java without using SubString

    This sounds like homework, and we aren't just going to do your assignment for you.

    What have you tried? Where are you stuck?
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Giggity is offline Member
    Join Date
    Jan 2013
    Posts
    6
    Rep Power
    0

    Default Re: How to reverse a string in Java without using SubString

    Its a workseet yet, but we have recieved incoffiient help and i need an idea on how it works. if i wanted the awnsers i would of asked for them

  4. #4
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,702
    Rep Power
    8

    Default Re: How to reverse a string in Java without using SubString

    Right, okay, so what have you tried? Have you looked at the API and basic tutorials at all? Where exactly are you stuck?
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  5. #5
    Giggity is offline Member
    Join Date
    Jan 2013
    Posts
    6
    Rep Power
    0

    Default Re: How to reverse a string in Java without using SubString

    I have been using a while loop, i have been trying to use acharAt but nothign seems to be working atm

  6. #6
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,702
    Rep Power
    8

    Default Re: How to reverse a string in Java without using SubString

    What exactly do you mean when you say it isn't working? What do you expect it to do? What does it do instead? Have you tried stepping through it with a debugger, or at least adding some print statements to figure out what's going on?

    Note: it'll be a lot easier to help you if you ask a specific question ("I'm trying to accomplish X, so I'm doing Y, expected Z, but got ABC instead") and post an SSCCE showing what you're trying to do.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  7. #7
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,450
    Rep Power
    19

    Default Re: How to reverse a string in Java without using SubString

    Quote Originally Posted by Giggity View Post
    I have been using a while loop, i have been trying to use acharAt but nothign seems to be working atm
    That implies you have written some code that doesn't do what you want it to.
    Posting that code, wrapping it in [code] tags [/code] so it appears properly, and telling us any errors/exceptions you are getting (in full) and where will give us a chance to actually explain where you are going wrong.

    It shows us that you have actually done some work on this, and shows us where you are having problems. We try and avoid supplying full solutions to these sorts of problems.
    Please do not ask for code as refusal often offends.

  8. #8
    Giggity is offline Member
    Join Date
    Jan 2013
    Posts
    6
    Rep Power
    0

    Default Re: How to reverse a string in Java without using SubString

    public class reverse {

    public static void main(String[] args) {

    //String s = "Syndicate";
    //r = s.charAt(1);

    char reverse;


    // String s = " Syndicate ";

    // s.charAt[1];


    String s = " Syndicate ";
    reverse = .charAt(2);


    System.out.println(s);


    }

    }

    Thsi si what i have done so far. Keep in mind i am an amateur programmer

  9. #9
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,702
    Rep Power
    8

    Default Re: How to reverse a string in Java without using SubString

    You forgot the code tags.

    And what does this code do? Does it compile?
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  10. #10
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,450
    Rep Power
    19

    Default Re: How to reverse a string in Java without using SubString

    You've missed out virtually everything I asked for (apart from the code).
    No code tags, no errors, no description of where you are stuck.
    Please do not ask for code as refusal often offends.

  11. #11
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,189
    Rep Power
    19

    Default Re: How to reverse a string in Java without using SubString

    You were told about the code tags. Edit your post to include them.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  12. #12
    Giggity is offline Member
    Join Date
    Jan 2013
    Posts
    6
    Rep Power
    0

    Default Re: How to reverse a string in Java without using SubString

    What are where can i find teh code tags

  13. #13
    Giggity is offline Member
    Join Date
    Jan 2013
    Posts
    6
    Rep Power
    0

    Default Re: How to reverse a string in Java without using SubString

    This is all i have done, i dont know what to do next. And as far as errors there are no errors i have tried using a charAt but get no results

  14. #14
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,023
    Blog Entries
    7
    Rep Power
    20

    Default Re: How to reverse a string in Java without using SubString

    Quote Originally Posted by Giggity View Post
    Thsi si what i have done so far. Keep in mind i am an amateur programmer
    Reversing a String might fail for your code, it works at least partially for your natural language texts ...

    kind regards,

    Jos

    ps. did you read the API documentation for the String class?
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Replies: 10
    Last Post: 03-15-2012, 10:46 AM
  2. A string and substring problem
    By calnastic in forum New To Java
    Replies: 4
    Last Post: 07-18-2011, 09:02 PM
  3. How do I remove a substring from a string?
    By Unnel in forum New To Java
    Replies: 16
    Last Post: 07-11-2011, 11:56 AM
  4. Reverse a string not using the substring method
    By kathyla18 in forum New To Java
    Replies: 17
    Last Post: 04-08-2009, 04:08 AM
  5. String substring function
    By ravian in forum New To Java
    Replies: 6
    Last Post: 01-02-2008, 07:35 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
  •