fork(3) download
  1. interface Foo {
  2. void bar();
  3. }
  4.  
  5. class NotFoo {
  6. public void bar() { }
  7.  
  8. public static void main (String[] args) {
  9. Foo broken = (Foo) new NotFoo();
  10. }
  11. }
Runtime error #stdin #stdout #stderr 0.12s 320576KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Exception in thread "main" java.lang.ClassCastException: NotFoo cannot be cast to Foo
	at NotFoo.main(Main.java:9)