String Reverse in Java...!

Answer Posted / aravinda reddy

String reverse without using reverse method string class

public class StringReverse {
public static void main(String[] args) {
String str = "Aravind";
StringBuffer s = new StringBuffer();
char[] ch = str.toCharArray();
int n = ch.length;
for(int i=n-1;i>=0;i--)
s.append(ch[i]);
System.out.println(s.toString());
}
}

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 a working thread? : Java thread

548


Why java is considered as platform independent?

588


What are void pointers?

710


What is a conditional equation?

558


Give an example of use of pointers in java class.

561






Which one will take more memory: an int or integer?

767


What is string length in java?

488


'A class is a template for an object' explain this statement.

544


What is covariant return type?

639


How does finally block differ from finalize() method?

583


Can each java object keep track of all the threads that want to exclusively access it?

534


What is the difference between preemptive scheduling and time slicing?

584


What is sortedmap in java?

547


What are some examples of variable costs?

486


What is parameter example?

540