Java 接口

思考问题一、什么是接口?

接口是一些方法特征的集合。只有方法的特征而没有方法的实现。html

思考问题二、为何使用接口

能够抽象一些通用的方法,规范类的行为。sql

思考问题三、接口常见用法

单方法接口,less

接口里面只有一个方法。ide

标志接口,sqlserver

只是一个标志,没有方法行为。this

常量接口spa

定义一些常量,这样全部实现的接口的子类均可以像本身定义的方法同样使用。code

思考问题4、什么是hardcode

        In computer programming or text markup, to hardcode (less frequently, hard code) is to use an explicit rather than a symbolic name for something that is likely to change at a later time. Such coding is sometimes known as hardcode (noun) and it is more difficult to change if it later becomes necessary. In most programming languages, it is possible to equate a symbol with a particular name (which may also represent a number) value. If the name changes, the symbol stays the same and only the equate line of code needs to be changed to reflect the new name. When the program is recompiled, the new name is picked up wherever the symbol occurs in the code. Although there are search-and-replace tools that can change all occurrences of a given name, program code is very unforgiving in case a small error is introduced, and it is safer to have a single place in which such a change can be made. For this reason, hardcoding is usually a practice to be avoided. Hardcode is also sometimes used in describing more difficult programming languages such as C or C++ rather than such "softcode" languages as Visual Basic.
 server

相关文章
相关标签/搜索