Avoid null cast and replace println() with "%n" in printf().