Suppose I have this code
public class Test{
public static void main (String args[]) {
String s = "thrones";
System.out.println("Game of" + "thrones" == s) ;
}
}
The output of the above code block is just 'false'
But shouldn't it print 'Game of true'
However if i put a parenthesis for the ("thrones"==s), it prints properly
System.out.println("Game of" + ("thrones"==s));
'Game of true'
I am just curious why it isn't taking the first part of the print in the first case. I just want to know whats going on there while compiling.
Thanks.