The expressions which evaluate to a boolean value can not be concatenated with a String in Java. Why?
<p>Let's see the following simplest code snippet in Java.</p>

<pre><code>final public class Parsing
{
    public static void main(String[] args)
    {
        int p=10;
        int q=10;

        System.out.println(p==q);
    }
}
</code></pre>

<hr>

<p>The above code in Java is fine and displays <strong>true</strong> as both p and q of the same type (int) contain the same value (10). Now, I want to concatenate the argument of println() so that it contains a new line escape sequence <strong>\n</strong> and the result is displayed in a new line as below.</p>

<pre><code>System.out.println("\n"+p==q);
</code></pre>

<p>Which is not allowed at all because the expression <strong>p==q</strong> evaluates a boolean value and  a boolean type in Java (not Boolean, a wrapper type) can never be converted to any other types available in Java. Therefore, the above mentioned statement is invalid and it issues a compile-time error. What is the way to get around such situations in Java?</p>

<hr>

<p>and surprisingly, the following statements are perfectly valid in Java.</p>

<pre><code>System.out.println("\n"+true);
System.out.println("\n"+false);
</code></pre>

<p>and displays true and false respectively. How? Why is the same thing in the statement <code>System.out.println("\n"+p==q);</code> not allowed?</p>
