Viewing code of Sort
// ------ Sort.java --------------
//--- Programmed By Rajesh -----

//Write a Program to sort given worlds using compareTo()
//String str="Holi"+"is"+"festival"+"of"+"colors";


import java.lang.*;

class Sort{
public static void main(String argS[]){
//String str=new String();
String word[]={ "Holi","is","a","festival","of","colors"};
//System.out.print=("the string is ="+ words);

for(int i=0; i<word.length; i++)
{
for(int j=i+1;j<word.length;j++)

if(word[i].compareTo(word[j])>0)

{ String s=word[i];
word[i]=word[j];
word[j]=s;


}}

for(int k=0;k<word.length;k++)
System.out.println(word[k]);

}
}