Java Hello World program without using a semicolon
KW.java
class KW { public static void main(String args[]) { if(System.console().writer().printf("Hello, World!\n")==null) { } } }
KW.java
class KW { public static void main(String args[]) { if(System.out.format("%s", "Hello, World!\n")==null) { } } }
KW.java
class KW { static { if(System.out.printf("Hello, World!\n")==null) { } } public static void main(String args[]) { } }
KW.java
class KW { public static void main(String args[]) { if(System.out.printf("%c%c%c%c%c%c%c%c%c%c%c%c%c\n" ,72,101,108,108,111,44,32,87,111,114,108,100,33)==null) { } } }
KW.java
class KW { public static void main(String args[]) { if(System.out.append("Hello, World!\n")instanceof Object) { } } }
KW.java
class KW { public static void main(String args[]) { try { if(System.out.getClass().getDeclaredMethod("println",Class .forName("java.lang.String")).invoke(System.out,"Hello, World!")==null) { } } catch(Exception e) { } } }
KW.java
class KW { public static void main(String args[]) { if(System.out.printf("Hello, World!\n")==null) { } } }
KW.java
class KW { public static void main(String a[]) { while(System.out.printf("Hello, World!\n")==null) { } } }
KW.java
class KW { public static void main(String args[]) { if(System.out.append("Hello, World!\n").equals(null)) { } } }
Output
kodingwindow@kw:~$ javac KW.java
kodingwindow@kw:~$ java KW Hello, World! kodingwindow@kw:~$
Comments and Reactions
What Next?
Java program to perform the arithmetic operations
Java program to perform the boolean operations
Java program to perform the relational operations
Advertisement