Sample Input: Java is one of the most famous language in the world
Sample Output: the
In the above example 'the' occurred two times that is nothing but the most frequently occurred word. So, the output should be 'the'.

The program for above example is given below:

Program:

import java.util.Arrays;

public class MostFrequentOccuorence 
{

public static void main(String[] args) 
  {
    String myStr = "the most frequent repeated word in string is most";
    String[] arr= myStr.split(" "); //will split the words
    Arrays.sort(arr);  // will sort the words in ascending order
    int max = 0;
    int count= 1;
    String word = arr[0];
    String curr = arr[0];
    for(int i = 1; i<arr.length; i++)  //logic for finding the most frequently occurred word
     {
        if(arr[i].equals(curr))
         {
            count++;
        }
        else
         {
            count =1;
            curr = arr[i];
        }
        if(max<count)
         {
            max = count;
            word = arr[i];
        }
    }
    System.out.println(word);
  }
}