Skip to content

Instantly share code, notes, and snippets.

@kabutz
Last active October 26, 2016 18:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kabutz/9946f424c621d9f3b1782484d40228e4 to your computer and use it in GitHub Desktop.
Save kabutz/9946f424c621d9f3b1782484d40228e4 to your computer and use it in GitHub Desktop.
It is possible to compile this code with JDK 8, but not with JDK 9. What can happen when you run it? Vote here: https://twitter.com/heinzkabutz/status/791220763059781632
abstract class Brick {
public Brick() {
greet();
}
public abstract void greet();
}
public class HardPlace {
public class Between extends Brick {
public void greet() {
System.out.println("Hello " + assert);
}
}
private final String assert;
public HardPlace(String assert) {
this.assert = assert;
}
public void test() {
new Between();
}
public static void main(String[] assert) {
new HardPlace("Franz").test();
}
}
@kabutz
Copy link
Author

kabutz commented Oct 26, 2016

OK, deleting any comments that contain spoilers ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment