This can be done in a very simple way. "printf" returns PrintStream. So we can put it in if block and no need to use semicolon.
public class HelloClass {
public static void main(String a[]) {
if(System.out.printf("Hello World") == null) {
//No need to define something here
}
}
}
//OUTPUT:
// Hello World
Comments
Post a Comment