Write a Java Program to convert "Welcome to Java" to "Java to Welcome".

Check below code:

package com.test.strings;

public class StringWords 
{
	public static void main(String args[])
	{
		String s = "Welcome to Java";
		
		String a[] = s.split(" ");
		
		String rev = "";
		
		for(int i = a.length - 1; i >= 0; i--)
		{
			rev = rev + a[i] + " ";
		}
		
		System.out.println(rev);
	}
}

Output: Java to Welcome