class X { { Proc procs = new Proc() { public void f(String s) { //To change body of implemented methods use File | Settings | File Templates. } }; Proc proci = new Proc() { public void f(Integer s) { //To change body of implemented methods use File | Settings | File Templates. } }; procs.f(""); proci.f(0); } } interface Proc { void f(T t); }