Results 1 to 11 of 11
- 03-03-2011, 01:19 PM #1
Member
- Join Date
- Mar 2009
- Posts
- 6
- Rep Power
- 0
- 03-03-2011, 01:53 PM #2
What have you tried?
And I'm pretty sure you're just misusing some vocabulary here. It's going to be impossible to create one String based on another String without allocating a new String, even if you do end up saving that new String to the same variable.
Hint- Are you allowed to use a StringBuilder?How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
- 03-03-2011, 01:56 PM #3
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 8
Reflection and modify the char[] "behind" the string. Not that I actually suggest you try that, but it is possible.
- 03-03-2011, 02:00 PM #4
How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
- 03-03-2011, 02:05 PM #5
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 8
Well, I would give it an A (for @ss as in <dry>Smart@ss</dry>).
- 03-21-2011, 03:40 PM #6
Member
- Join Date
- Mar 2011
- Location
- Bulacan, Philippines
- Posts
- 23
- Rep Power
- 0
String a="abcdefghijklmn";
a = new StringBuilder(a).reverse();Keep Moving Forward
- 03-21-2011, 06:05 PM #7
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 8
- 03-22-2011, 04:14 AM #8
Senior Member
- Join Date
- Jan 2009
- Posts
- 671
- Rep Power
- 5
Strings are immutable. You can not alter a String, you can only create new ones.
- 03-22-2011, 04:20 AM #9
If the actual objective is to just display the reversed String then use a reverse loop.
- 03-22-2011, 04:55 AM #10
Do not spoonfeed people code as it hinders their learning.
Do not communicate privately as this goes against the spirit of sharing information on a forum.
- 03-22-2011, 05:39 AM #11
Similar Threads
-
Reverse a string?
By cysquatch in forum New To JavaReplies: 15Last Post: 03-23-2010, 02:31 AM -
reverse string split
By Fittersman in forum Advanced JavaReplies: 4Last Post: 03-09-2010, 12:29 AM -
reverse a string with a while loop...
By OptimusPrime in forum New To JavaReplies: 9Last Post: 12-28-2009, 11:06 PM -
Reverse a string not using the substring method
By kathyla18 in forum New To JavaReplies: 17Last Post: 04-08-2009, 04:08 AM -
Non Allocating String Buffer
By chrisdb89 in forum New To JavaReplies: 5Last Post: 10-25-2008, 06:57 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks