The compiler does not know that you have given it a value, for all it know's your trying to do

int carrots;
if(1 == 2)
{
carrots = 2;
}
System.out.println(carrots);
, what is it suppose to...