Passing data from one class to another in Java
<p>I am trying to pass an output to a text area. </p>

<p>I have <code>Class Search</code> which handles all the searching and display the output using <code>System.out.println()</code>. </p>

<p>I have created <code>Class GUI</code> in order to make the console output <code>(System.out.println())</code> appear in the <code>JTextArea</code>.</p>

<p>I am trying to pass that data into the text area using objects but I dont know why it is not working. </p>

<p><code>Class Search</code> has this method that calculates the output:</p>

<pre><code> public static void searchIndex(String searchString) throws IOException, ParseException 
</code></pre>

<p><code>Class GUI</code> has the <code>text1</code></p>

<p>In Class GUI I have tried this: </p>

<pre><code>text1.setText(Search.searchIndex(searchString));
</code></pre>

<p>but it is giving me an error <code>searchString cannot be resolved to a variable</code></p>

<p>Any suggestions ?</p>

<p>Regards.</p>
