How can we read the previous line in console?
<p>Is there a way to read the previous line in the console? My current code prints out Hello, and I want to print another message if it contains or doesn't contain the word? </p>

<p>I wrote an example below. I know there is code required within the if statement but I can't figure what code is needed.</p>

<pre><code>System.out.println("Hello");

if (something){ 
    System.out.println("Line above contains the word Hello");
}
else(!something){
    System.out.println("Line above does not contain the word Hello");
}
</code></pre>