tests: generics
authorBernhard Urban <lewurm@gmail.com>
Sun, 20 May 2012 13:17:23 +0000 (15:17 +0200)
committerBernhard Urban <lewurm@gmail.com>
Sun, 20 May 2012 19:47:10 +0000 (21:47 +0200)
tests/Generics1.java [new file with mode: 0644]

diff --git a/tests/Generics1.java b/tests/Generics1.java
new file mode 100644 (file)
index 0000000..4e3d262
--- /dev/null
@@ -0,0 +1,21 @@
+package tests;
+
+public class Generics1 implements Cmp<Integer> {
+       public Integer a = new Integer(0x1337);
+       public int cmpto(Integer o) {
+               return a.intValue() - o.intValue();
+       }
+
+       public static Cmp<Integer> sb = new Generics1();
+
+       public static void main(String []args) {
+               Generics1 foo = new Generics1();
+               System.out.printf("0x%08x\n", foo.cmpto(0x666));
+               System.out.printf("0x%08x\n", sb.cmpto(0x666));
+       }
+}
+
+interface Cmp<T>
+{
+       int cmpto(T o);
+}