Skip to content

Instantly share code, notes, and snippets.

@mhddurrah
Last active April 25, 2020 12:23
Show Gist options
  • Save mhddurrah/41a839a32cf58172dc0ac77f015472b4 to your computer and use it in GitHub Desktop.
Save mhddurrah/41a839a32cf58172dc0ac77f015472b4 to your computer and use it in GitHub Desktop.
package com.why;
public class Why {
public static void main(String[] args) {
Gen<A> gen = new Gen<>();
gen.m(new A()); //eeeeeeeeee A
}
}
class A {}
class B extends A {}
class C extends A {}
class Gen<E> {
Test test = new Test();
public void m(E e) {
test.test(e);
}
}
class Test {
public <E extends A> void test(E e) {
System.out.println("XXXXXXXXXX " + e.getClass().getSimpleName());
}
public <E> void test(E e) {
System.out.println("eeeeeeeeee " + e.getClass().getSimpleName());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment