Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Printing reverse of any String without using any predefined function?

How to print the reverse of the String java is object orientated language without using any predefined function like reverse()?

like image 260
Sanjeev Avatar asked Apr 10 '10 10:04

Sanjeev


People also ask

How do I reverse a string without making a new string?

If we take a look at program to reverse a string or array, all we need to do is swap two characters. The idea is to use XOR for swapping the variable.


1 Answers

This is the simplest solution:

System.out.print("egaugnal detatneiro tcejbo si avaj");
like image 143
Adriaan Koster Avatar answered Nov 15 '22 08:11

Adriaan Koster