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

What are the states of thread in java?

732


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

1000


Explain java heap space and garbage collection?

813


How do generics work in java?

717


What state does a thread enter when it terminates its processing in java programming?

810


Is java a software?

726


What best practices should you follow while writing multithreaded code in java?

798


What is difference between iterator access and index access?

868


What does ide stand for?

721


What are the drawbacks for singleton class?

774


What is the different between get and post?

744


What is a top level class in java?

760


Is java type safe?

766


Explain scope or life time of local variables in java?

813


Say any two properties in beans?

821