System.out.printf prints the string and returns printstream object which is consumed by if statement by checking for null value.
System.out.print function does not return anything as it's return type is void, and void is not a valid type, it's just a placeholder indicating "no type". if doesn't know how to deal with void, so it gives error
java.io.PrintStream.printf() and java.io.PrintStream.append() return PrintStream object so you can test if it is null. Printstream send chars from printf() and append() methods to output, ( to screen ).
It is possible use printf() with only one parameter because other parameters are in Object... args, which can be empty.
print return void so you cant test if it is null, because void is not object, it is keyword which means "no value is return".
PrintStream printf(String format, Object... args)
PrintStream append(CharSequence csq)
void print(String s)