Number of occurrences of each different word in a line of text
The easiest way would be to use a LinkedHashMap&lt;String,AtomicInteger&gt;, adding the words in order.

LinkedHashMap is a Map, so duplicate keys can easily be detected. AtomicInteger will allow incrementing the value without having to replace the value in the Map. Yet AtomicInteger isn't exactly intended to be used as a dumb counter, making your own Counter class is also a good option, as long as it has an increment() and a get() method, it'll make your interaction with the Map a lot smoother.

You can use String.split() to break up the input String in words.

Quick pseudo code:

split input String into words
loop the words
   if word not in map
      add word as key, with new counter
   get counter for word and increment
loop map entries
   print word and number of occurrences


Edit

Given the scope of your knowledge, I'll make a suggestion that only uses what you should know already. The idea is to replace the Map by an ArrayList of words and a matching array of int to hold the counts.

split input String into words
initialize an int[] array with the size equal to the number of words // max needed capacity
initialize an ArrayList of Strings
loop the words
   determine index of the word in ArrayList.
   if word not in ArrayList
      add word to ArrayList
   increment int in array at matching index as the word in the ArrayList
loop ArrayList
   print word and number of occurrences (from same index in array)