How to concatenate string in a for loop using scanner? : <p>package exercises;</p>

<p>import java.util.Scanner;</p>

<p>public class SentenceBuilder {</p>

<pre><code>public static void main(String[] args) {
    final int MAX_WORDS = 5;

    Scanner scan = new Scanner(System.in);
    String word ="";

    for (int i = 0; i &lt; 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

}
</code></pre>

<p>}</p>
