1 2 3 4 5 6 7
public class X { void f(Object action) { if (action instanceof Runnable) { Runnable runnable = (Runnable)action; } } }