Java Word Counter

Create a Java function where you can input a string of text and the function prints out how many words there are in it.

$20