Last active
August 29, 2015 14:14
-
-
Save peter-lawrey/ebe30191c32c5dd3cfc8 to your computer and use it in GitHub Desktop.
A program without class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
In Java 8 this program prints | |
java.lang.Throwable | |
at A.printStackTrace(A.java:8) | |
at A.<clinit>(A.java:5) | |
at java.lang.Class.forName0(Native Method) | |
Note: <clinit> is the static initializer method for interface A | |
*/ | |
public interface A { | |
int a = printStackTrace(); | |
static int printStackTrace() { | |
new Throwable().printStackTrace(); | |
return 0; | |
} | |
public static void main(String[] args) { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment