Using If to break Java statement and displaying input backwards
<p>I need to incorporate an IF statement to break the script when the user enters the letter Q.</p>

<p>I also need to display their input backwards to them - I am unsure on how I would do this, here is my code.</p>

<pre><code>import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Scanner;


public class ArrayListOfNames {

    public static void main(String[] args) throws FileNotFoundException {

        ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;();
        Scanner Scan = new Scanner (System.in);

        String name;

        System.out.println("Please enter some words (You may press Q to finish):  ");

        while (Scan.hasNext())
        {
            name = Scan.nextLine();
            list.add(name);
        }


        Scan.close();

    }

}
</code></pre>
