How to print the reverse of the String java is object orientated language
without using any predefined function like reverse()
?
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.
This is the simplest solution:
System.out.print("egaugnal detatneiro tcejbo si avaj");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With