Java program to returning a string as reverse text



Program

package com.candidjava;

public class StringReverse {

public static void main(String args[])
{
	String string = "Welcome to Java Programming and Dotnet Programming";
	String[] wordsCount = string.split(" ");
	
	System.out.println("The Given String is:\n" + string + "\n");
	System.out.println("After Reverse String is:");
	
	for(int i = wordsCount.length;i > 0;i--)
	{
		System.out.print(wordsCount[i - 1] + " ");
		}
	}
}


Output

The Given String is:
Welcome to Java Programming and Dotnet Programming

After Reverse String is:
Programming Dotnet and Programming Java to Welcome




Related Post

Comments


©candidjava.com