can you program for reverse string?

Answer Posted / narayanan

public class reverse {
public static void main(String args[]){

String s="malayalam";
StringBuffer sb=new StringBuffer();
int k=s.length();
for (int i = k-1; i >-1; i--) {
sb.append(s.charAt(i));

}
System.out.println(sb);
}

}

Is This Answer Correct ?    9 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

If you do not want your class to be inherited by any other class. What would you do?

781


How is it possible for two string objects with identical values not to be equal under the == operator?

744


Can an unreferenced object be referenced again?

944


Can a class extend more than one class?

847


Can we have more than one package statement in source file ?

782


What is the difference between the size and capacity of a vector?

792


What is meant by binding in rmi?

776


What are peerless components in java programming?

776


How do you check if two strings are equal in java?

803


What is the reason behind using constructors and destructors?

798


What is the original name of java?

776


Is java ee a framework?

730


Explain java thread life cycle.

799


What is the difference between super class & sub class?

804


Does java trim remove newline?

729