包裹练习;
import java.util.Scanner;
公共类SentenceBuilder {public static void main(String[] args) {
final int MAX_WORDS = 5;
Scanner scan = new Scanner(System.in);
String word ="";
for (int i = 0; i < MAX_WORDS; i++){
System.out.println("Please enter word "+(i+1)+" of "+MAX_WORDS);
word = scan.nextLine();
}
System.out.println(word);// im stuck on how to concatenate the result
}
}
答案 0 :(得分:0)
在for
:
word = word + scan.nextLine();