题目:把一个英语句子中的单词次序颠倒后输出
public class test {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("请输入字符串:");
String str = scanner.nextLine();
String[] strs = str.split(" ");
for(int i = strs.length-1;i>=0;i--)
{
System.out.print(strs[i]+" ");
}
System.out.print("\n");
}
}