Linked Questions
85 questions linked to/from Reverse a string in Java
-2
votes
1
answer
16k
views
Reversing a String using a for loop [duplicate]
I just want to reverse a inputted String by using for loop.
I have tried the following code below. [ its full of mistake i think.. cause i dont know how to convert things to array or to string in ...
2
votes
3
answers
6k
views
Improving this code for reversing the string and removing duplicate characters [duplicate]
I recently attended an interview where I was asked to write a program.
The problem was:
Take a string. "Hammer", for example.
Reverse it and any character should not be repeated.
So, the output ...
1
vote
3
answers
2k
views
Fastest Way To Reverse Long Java [duplicate]
What's the fastest way to reverse a Long value?
For example, 9876543210 should return 0123456789.
This is what I have right now:
long n = 0, c = 987654321 * 10; // *10 is to get 9876543210 as long ...
-1
votes
4
answers
2k
views
Eclipse JAVA String reverse - reversing 1 word which is pre-declared [duplicate]
Like to know how to reverse a string value (1 word) which is pre-declared in the program. I mean not using user input or scanner.
Like to reverse a word "TRAIN" which is pre-declared in the program.
...
1
vote
3
answers
1k
views
Java reverse string [duplicate]
I'm trying to make a code that reverse's a string, I know there are more easy ways to do this but I just wanted to know why this code does not work:
public class Reverse
{
/**
* Prints a ...
-4
votes
1
answer
1k
views
Reverse a String and store it in the same variable in Java using String class methods [duplicate]
Suppose there is a string variable str = "A man is no one!", then i need the reverse of this string to be stored in same str variable as "!eno on si nam A", without using any other object or variable....
-2
votes
1
answer
827
views
How to reversing user input String? [duplicate]
I am trying to reverse user input string my code below is working so that it just output as same as input value..
For example "Hello" will come out "Hello" while result should be "olleH"
This is my ...
-2
votes
3
answers
176
views
Trying to reverse a string on Java. Why can't I get the reversed text as my only output? [duplicate]
I can't get my function to return the reversed string. I keep getting the original string, plus the reversed sting attached together.
P.S this is obviously a question from someone new. Cut me some ...
-5
votes
2
answers
196
views
This is a question about reversing a string [duplicate]
Write a function that reverses a string. The input string is given as an array of characters char[].
Do not allocate extra space for another array, you must do this by modifying the input array in-...
1
vote
1
answer
337
views
Java text reverse [duplicate]
I am just a beginner and do not know how to reverse text that I write on input so it is reversed on output. I wrote something like this:
public static void main(String[] args) {
Scanner sc = ...
0
votes
1
answer
228
views
How to format a label with a comma delimiter in reverse using JavaFX [duplicate]
So basically I want to do the following:
String s1 = "hello";
for(int count = s1.length() -1; count >= 0; count--){
System.out.printf("%c, ", s1.charAt(count));
}
but do that in ...
0
votes
3
answers
103
views
Array opposite string. Must use arrays [duplicate]
How do i make an array with the opposite letters of the first array im making? For example if the string is "Hello", i want to use arrays to print out "olleH". When i try to return the variables it ...
0
votes
1
answer
117
views
How to store the char array back to sting in a loop? [duplicate]
Scanner sc = new Scanner(System.in);
System.out.print("Enter the number to reverse ");
String mystring = sc.nextLine();
char[] my_3 = mystring.toCharArray(); // string converted ...
0
votes
0
answers
97
views
Reverseing a string in java [duplicate]
if i need to reverse a given string like " HELLO WORLD " to become
"DLROW OLLEH "
so how can do that ? and if there is any function that do the same what is it ?
-3
votes
2
answers
94
views
Trying to get reverse of string input [duplicate]
Trying to reverse the string input.
Eg:
input- hello friend
output- dneirf olleh
Here is the program I made but it shows string index out of range as error:
import java.io.*;
class ...