Calsoft Interview Question: reverse each word in a senten... |

Interview Question

Developer I Interview(Student Candidate)

reverse each word in a sentence and make the first letter

  of the reversed words capital

Interview Answer

1 Answer


package com.test.demo;

public class ReverserString {

    public static void main(String[] args) {

        String str="Akash Phadtare Living In Saswad";

        String reverseString= "";

        String words[] = str.split(" ");

        for(int i=0;i=0;j--){
                char ch = word.charAt(j);
                tempString = tempString +ch;
                reverseString = reverseString + tempString.toUpperCase()+" ";
            reverseString = reverseString + tempString+" ";



Akash on 15-Sep-2017

Add Answers or Comments

To comment on this, Sign In or Sign Up.