String Input Library

Write a Java program without using any library function in string
i/p: My name is Rama
o/p: Rama si eman yM

Showing Answers 1 - 3 of 3 Answers

Léa

  • Jan 31st, 2017
 

Code
  1. String sentence = "My name is Rama";

  2.                 StringBuffer reversedSentence = new StringBuffer();

  3.                 for (int i = sentence.length() - 1 ; i >= 0; i --) {

  4.                         reversedSentence.append(sentence.charAt(i));

  5.                 }

  6.                 System.out.println(reversedSentence.toString());

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions