Skip to content

Instantly share code, notes, and snippets.

@z-a-ki3
Created April 29, 2015 09:05
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 z-a-ki3/0570c48f06df0decd731 to your computer and use it in GitHub Desktop.
Save z-a-ki3/0570c48f06df0decd731 to your computer and use it in GitHub Desktop.
interface Z { }
class Y extends X { public String toString() { return "Y"; } }
class X implements Z { public String toString() { return "X"; } }
public class Test {
public static void main(String[] args) {
Y y = new Y();
X x = y;
Z z = x;
System.out.print(x + " ");
System.out.print((Y)x + " ");
System.out.print(z + " ");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment