Write a program to print Reverse words from string
Public static void main ( String args [] )
{
String s="Selenium with java";
Char words[]=s.split(" ");
StringBuffer reverse=new Stringbuffer ();
For(String word:words)
{
StringBuffer sb=new StringBuffer(word);
Sb.append(sb.reverse().append(" "));
}
System.out.println(sb.toString());
}
Comments
Post a Comment