How to type in a string that will be assigned to a variable?
<p>I need my program to ask the user to type in a String which will be assigned to a variable eg:string in the case below so the array list can be searched for a String containing the String entered by the user.</p>

<pre><code>public void search(){
    String string = "";
    for (int i = 0; i &lt; wordArray.size(); i++){
        if (wordArray.get(i).contains(string) == true){
            System.out.println(wordArray.get(i));
        }
        else{
            System.out.println("No words match your search.");
        }
    }
}
</code></pre>
