C:\tom\dev\projects\de.tutorials.training.java8\src\main\java>
javac HelloWorld.java
C:\tom\dev\projects\de.tutorials.training.java8\src\main\java>
java -XX:-StackTraceInThrowable -cp . HelloWorld
Hello World!
import static java.lang.String.valueOf; | |
import static java.util.Arrays.fill; | |
/** | |
* Author: Thomas Darimont | |
*/ | |
public interface HelloWorld { | |
static void main(String[] args) { | |
char[] backspaces = new char[64]; | |
fill(backspaces, '\b'); | |
char[] spaces = new char[64]; | |
fill(spaces, ' '); | |
throw new RuntimeException(valueOf(backspaces) + "Hello World!" + valueOf(spaces)); | |
} | |
} |
import static java.lang.String.join; | |
import static java.util.Collections.nCopies; | |
/** | |
* Author: Thomas Darimont | |
*/ | |
public interface HelloWorld { | |
static void main(String[] args) { | |
throw new RuntimeException(join("", nCopies(64, "\b")) + "Hello World!" + join("", nCopies(64, " "))); | |
} | |
} |