package com.instaceofjava;

public class ReverseString {

public static void main(String[] args) {
String str="Hello world";

String revstring="";

for(int i=str.length()-1;i>=0;--i){
revstring +=str.charAt(i);
}
System.out.println(revstring);

}

}


Output: dlrow olleH

Instance Of Java

We are here to help you learn! Feel free to leave your comments and suggestions in the comment section. If you have any doubts, use the search box on the right to find answers. Thank you! 😊
«
Next
Write a program to Overriding in java?
»
Previous
Can you define an abstract class without any abstract methods? if yes what is the use of it?

No comments

Leave a Reply

Select Menu