java ,句子中的单词按顺序输出

问题描述:

java ,句子中的单词按顺序输出
老师出了一个别扭的题.一共四个英文句子
1 The bus was crowded and no vacant seat was to be found.
6 5 2 9 12 1 4 11 10 7 3 8
2 I will never come to such an unpleasant place again.
2 8 6 10 9 1 5 3 7 4
3 My family shall not want for anything as long as I live.
7 2 12 10 3 8 4 9 6 11 5 1
4 I have just been to the hospital to inquire after Mr.A.
11 4 2 9 7 10 1 6 3 5 8
首先,在屏幕上输出这四句话,然后问用户选择哪句话,然后 按句子下面的数字,一次输出对应位置的单词.如 输出3 ,则显示
anything family live as shall as not long for I want My

import java.util.Scanner;public class Test { public static void main(String[] args) {Scanner input = new Scanner(System.in);Test test1 = new Test("The bus was crowded and no vacant seat was to be ...