People help please. See, I have a proposal "Mom washed the frame. Dad is a great fellow." And the result should turn out to be the "mom's soap frame. Well done great dad." But according to my code, the first word of the sentence and the last word of the last sentence change.
public static void changing_place(String s) { String[] words = s.split(" ");//Разбиение строки на слова String temp = words[0];//записуем первое слово words[0] = words[words.length - 1];//находим послднее слово words[words.length - 1] = temp;// говорим что бып послденее записалось в первое for (String word : words) {//перебираем и записуем в новую строку System.out.print(word + " ");//выводим } System.out.println(); }