工具和工具之间有什么区别?在Java中扩展关键字 [英] What's the difference between the implements & extends keywords in Java

查看:119
本文介绍了工具和工具之间有什么区别?在Java中扩展关键字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Java中的以下关键字有什么区别: implements extends

What's the difference between the following keywords in Java: implements, extends?

推荐答案

接口应该表现为是这种规范的具体实现。

An interface is an abstract specification of how a class should behave whilst a class is a concrete implementation of such a specification.

因此,当你写 implements 你说你正在实现你编写的实现中的一些抽象规范。

Therefore, when you write implements you're saying that you are fulfilling some abstract specification in the implementation you've written.

extends 表示您采用实现( class )或规范( interface )并添加不同的或新的功能(或更改其行为的规范),从而修改其行为并扩展 - 它。

extends means that you take either an implementation (class) or specification (interface) and add to it with different or new functionality (or change the specification of its behaviour), thus modifying its behaviour and extend-ing it.

这篇关于工具和工具之间有什么区别?在Java中扩展关键字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆