Reverse a word from the given string in Java

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


        String str = "welcome to the java world";


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


        // I want to reverse java from the given String


        String s= split[3];


        String rev="";


        for(int i=s.length()-1; i>=0; i--)
        {
            rev = rev+s.charAt(i);
        }


        System.out.println(rev);
    }

}

---------------------------------------------------------------------------------------------------------------------------------

avaj

Comments

Popular posts from this blog

Mr. Myers wants to edit the marks assigned to the questions

Genral Ability

Object Orinted Programing