内射老阿姨1区2区3区4区_久久精品人人做人人爽电影蜜月_久久国产精品亚洲77777_99精品又大又爽又粗少妇毛片

java中的interface接口實例詳解-創(chuàng)新互聯(lián)

創(chuàng)新互聯(lián)www.cdcxhl.cn八線動態(tài)BGP香港云服務器提供商,新人活動買多久送多久,劃算不套路!

創(chuàng)新互聯(lián)公司基于分布式IDC數(shù)據(jù)中心構(gòu)建的平臺為眾多戶提供四川雅安服務器托管 四川大帶寬租用 成都機柜租用 成都服務器租用。

 java中的interface接口實例詳解

接口:Java接口是一些方法表征的集合,但是卻不會在接口里實現(xiàn)具體的方法。

java接口的特點如下:

1、java接口不能被實例化
2、java接口中聲明的成員自動被設置為public,所以不存在private成員
3、java接口中不能出現(xiàn)方法的具體實現(xiàn)。
4、實現(xiàn)某個接口就必須要實現(xiàn)里面定義的所有方法。

接下來看一個實現(xiàn)接口的案例:

 



package hello;   interface competer{ //定義接口 void set_compt(int com); void print_compt_information(); } class bj implements competer{ //接口實現(xiàn) int com ; public void set_compt(int com) { this.com = com ; // System.out.println("端口" + com); } public void print_compt_information() { System.out.println("端口" + com); System.out.println("筆記本"); } } class taishi implements competer{ int com ; public void set_compt(int com) { this.com = com ; //System.out.println("端口" + com); } public void print_compt_information() { System.out.println("端口" + com); System.out.println("臺式機"); } } public class inter { public static void main(String[] args) { taishi com = new taishi(); bj bjj = new bj(); com.set_compt(100); bjj.set_compt(120); com.print_compt_information(); bjj.print_compt_information(); } }

當前標題:java中的interface接口實例詳解-創(chuàng)新互聯(lián)
標題路徑:http://www.rwnh.cn/article8/dpship.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供企業(yè)網(wǎng)站制作、網(wǎng)站導航動態(tài)網(wǎng)站、移動網(wǎng)站建設外貿(mào)網(wǎng)站建設、品牌網(wǎng)站制作

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

h5響應式網(wǎng)站建設
阳高县| 云霄县| 静安区| 丰原市| 舞钢市| 新乡市| 军事| 沈丘县| 开封市| 南和县| 塔城市| 东安县| 星子县| 阿勒泰市| 青州市| 普兰店市| 安化县| 阿瓦提县| 小金县| 梅河口市| 星子县| 闻喜县| 藁城市| 东城区| 定州市| 开封县| 镇宁| 化德县| 理塘县| 泌阳县| 库尔勒市| 恩施市| 汾西县| 潞城市| 乌鲁木齐市| 前郭尔| 原阳县| 绥德县| 彭州市| 大宁县| 嘉定区|