Why is Java now Behaving Weird Like JavaScript?

Consider the below code: