Java проверяет, содержит ли строка несколько слов
String str1 = "It's a great day today.";
String[] words = str1.split(" ");
//["It's", "a", "great", "day", "today."]
boolean hasMultipleWords = words.length > 1;
System.out.println(hasMultipleWords);
Nia Nancheva