if statement should print string values
<p>How do I print result from if statements in Java? This result should be assigned to some variable, that variable should print result in string. Currently, my code is like this. I want to store simple &amp; extended into a single variable, so that i should able to call this variable anywhere in the program. There it should print "simple" or "extended".</p>

<pre><code>if(loc[i]==1) {
    System.out.println("simple");
}
else if(loc[i]&gt;1) {
    System.out.println("extended");
}
</code></pre>
