I want to change String "Hello World" to "World hello". Here's my code:
class StringTest
{
public static void main(String args[])
{
String str= "Hello World";
String wordcount[]=str.split(" ");
int count= wordcount.length;
System.out.println(count);
for(int i=count;i>0;i--)
{
System.out.print(wordcount[i]);
}
}
}
Getting error ArrayOutOfBoundException
. Please help.