How can you reverse a string?

Answer Posted / haneef

public class Main {
public static void main(String[] args)
{
String str1="HANEEF";
for(int i=str1.length();i>0;i--)
{
System.out.print(str1.charAt(i-1));
}
}
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between iterator and list iterator?

531


String and stringbuffer both represent string objects. Can we compare string and stringbuffer in java?

549


Can we have a method name same as class name in java?

578


How do you sort a list in java?

574


What is a treeset in java?

542






who can i handle multiple client in RMI

1440


What are examples of modifiers?

508


What are encapsulation, inheritance and polymorphism?

527


Can we override the overloaded method?

561


What is Session reduplication and how its done?

1562


Why enumeration is faster than iterator?

527


What is a protected void?

502


Can we declare main () method as non static?

518


What is currentthread()?

570


Which collection is thread safe in java?

509