Is there any noticeable difference between
boolean foo= bar>1;
and
boolean foo = bar>1? true:false;
I have noticed that in the first example, the condition is evaluated immediately, looking something like this.
int bar=3;
boolean foo= bar>1;
bar =0;
if(foo){
System.out.println("Foobar");
}
Would print Foobar, whereas if the condition were to be inside the if statement, it would not print at all. This so far is identical to giving the boolean variable a true/false value from the start with the ternary operator or if/else