Java中类不能多重继承,接口可以多重继承
2013-11-13 22:31
288 查看
在java.util.concurrent.RunnableFuture.class 中 有个接口,如下:
不多说,案例最明白!
/* * @(#)RunnableFuture.java 1.3 06/01/30 * * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ package java.util.concurrent; /** * A {@link Future} that is {@link Runnable}. Successful execution of * the <tt>run</tt> method causes completion of the <tt>Future</tt> * and allows access to its results. * @see FutureTask * @see Executor * @since 1.6 * @author Doug Lea * @param <V> The result type returned by this Future's <tt>get</tt> method */ public interface RunnableFuture<V> extends Runnable, Future<V> { /** * Sets this Future to the result of its computation * unless it has been cancelled. */ void run(); }
不多说,案例最明白!
相关文章推荐
- 牛客网Java刷题知识点之Java为什么不能支持多继承,但可以用接口来间接实现多继承
- java中的接口为什么可以多继承,而其他类则不能实现多继承
- 对Java不能多继承,只能单继承,却可以实现多个接口的理解
- java的接口不能实例化,但是有些函数可以这样写
- 多继承有什么坏处,为什么java搞单继承,接口为什么可以摈弃这些坏处
- java设计模式--策略模式--规避继承的耦合度大和接口的不能复用
- Java 构造函数不可以继承,因此不能被重写,但可以被重载
- java 接口之多继承,类为什么不可以多继承
- 为什么Java语言中,类与类之间只能单根继承,类与接口可以多重实现,接口与接口却多根继承
- java 接口可以多继承
- java 接口可以多继承
- 【Java面试题】13 Anonymous Inner Class (匿名内部类) 是否可以extends(继承)其它类,是否可以implements(实现)interface(接口)?
- java的类单继承、接口可以多继承
- java中一个接口可以继承几个接口
- Java —— 接口可以多继承
- 【Java面试题】60 接口是否可继承接口? 抽象类是否可实现(implements)接口? 抽象类是否可继承具体类(concrete class)? 抽象类中是否可以有静态的main方法?
- JAVA接口可以实现多继承
- Java小程序---接口中抽象方法的实现(解决了JAVA语言不能多继承的问题)
- java 接口可以多继承
- java 中不能继承多个父类,除非本身和父类都是接口