Java之多继承

Java多继承

关于Java多继承,众所周知是不支持多继承,但这个一般指Java类不支持多继承,主要是由于避免子类被引用时候统同一方法无法判断应该使用哪个父类的方法;
有种特殊情况下,Java是支持多继承的,那就是接口(接口中的方法都是申明,没有具体实现):
如下所示:

public interface BlockingDeque<E> extends BlockingQueue<E>, Deque<E> {
  /*
     * We have "diamond" multiple interface inheritance here, and that
     * introduces ambiguities.  Methods might end up with different
     * specs depending on the branch chosen by javadoc.  Thus a lot of
     * methods specs here are copied from superinterfaces.
     */

    /**
     * Inserts the specified element at the front of this deque if it is
     * possible to do so immediately without violating capacity restrictions,
     * throwing an <tt>IllegalStateException</tt> if no space is currently
     * available.  When using a capacity-restricted deque, it is generally
     * preferable to use {@link #offerFirst offerFirst}.
     *
     * @param e the element to add
     * @throws IllegalStateException    {@inheritDoc}
     * @throws ClassCastException       {@inheritDoc}
     * @throws NullPointerException     if the specified element is null
     * @throws IllegalArgumentException {@inheritDoc}
     */
    void addFirst(E e);
    .....

}

在这里插入图片描述
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值