abstract class BaseTest implements Runnable {
}
class AdvancedTest extends BaseTest {
public void run() {
}
}
public class MainClass {
public static void main(String[] argv) throws Exception {
Object obj = new AdvancedTest();
if (obj instanceof BaseTest)
return;
System.out.println("Not a BaseTest");
if (obj instanceof Runnable)
return;
System.out.println("Not Runnable");
return;
}
}
|