| | |
Name Backwards Algorithm
![]() |
•
•
Join Date: Sep 2006
Posts: 8
Reputation:
Solved Threads: 0
Hi guys, back again...You guys were very helpful before and I ended up approaching it a totally different way. I used the mathematical way which is hard to explain but well...it worked so thanks.
Now I am having a problem constructing a program that prompts the user for a name and then displays it backwards. In this, I am excluding spaces so basically....john would be nhoj.
I know I am going to use toCharArray etc...But am i just going to use a for that decreases?
Now I am having a problem constructing a program that prompts the user for a name and then displays it backwards. In this, I am excluding spaces so basically....john would be nhoj.
I know I am going to use toCharArray etc...But am i just going to use a for that decreases?
Did you not read jwenting's reply directly above yours? Look in the API for a single method call to reverse a String. I will give a small hint, the class is not String but does begin with it.
Java Programmer and Sun Systems Administrator
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
•
•
Join Date: Apr 2004
Posts: 573
Reputation:
Solved Threads: 5
•
•
•
•
Hi newbies in java. May i know how to do it without using array?
So:
Java Syntax (Toggle Plain Text)
for(int i = s.length(); i >=0; i--){ System.out.print(s.charAt(i); } System.out.println();
•
•
•
•
Hi guys, back again...You guys were very helpful before and I ended up approaching it a totally different way. I used the mathematical way which is hard to explain but well...it worked so thanks.
Now I am having a problem constructing a program that prompts the user for a name and then displays it backwards. In this, I am excluding spaces so basically....john would be nhoj.
I know I am going to use toCharArray etc...But am i just going to use a for that decreases?
knowledge is what I need
![]() |
Similar Threads
Other Threads in the Java Forum
- Previous Thread: validations
- Next Thread: Java Client/Server
| Thread Tools | Search this Thread |
-xlint add android api applet application applications array arrays automation bank bi binary blackberry bluetooth chat class client code compile compiler component database development digit eclipse equation error event fractal freeze functiontesting game gameprogramming givemetehcodez graphics gui health html hyper ide idea image infinite input int integer j2me java javame javaprojects jetbrains jni jpanel jtable julia learningresources linux list login loop main map method methods mobile myregfun netbeans newbie nonstatic notdisplaying pearl problem program programming project qt recursion scanner screen scrollbar server set sms sort sorting spamblocker sql sqlserver string superclass swing system text-file thread threads tree variablebinding windows xor







