generic-class

Passing ExecContext<?> to a method when you don't know the type

How can I pass a generic type to a method, when I don't know the type? public static class ExecContext<E> { public void doSomething(E e) { System.out.println(e); } } public static void exec(ExecContext<?> ctx) { String s = new String("saoj"); ctx.doSomething(s); // <============== COMPILE ERROR } ...