if (null != foo);
bar();
This is valid code in C and Java, and bar() will always run in this case.Having seen people waste hours on such a semicolon, I always use braces, even in one-liners, because I never know when someone is going to break it out into multiple lines later:
if (null != foo) { bar(); }