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

相關文章
相關標籤/搜索