内射老阿姨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)站建設
贵港市| 遂溪县| 商城县| 始兴县| 紫金县| 丘北县| 金湖县| 邯郸县| 婺源县| 安宁市| 璧山县| 佛山市| 松阳县| 丘北县| 浑源县| 都兰县| 贺兰县| 宜兰市| 台中县| 泰兴市| 华宁县| 荆州市| 泗洪县| 浦东新区| 九寨沟县| 集贤县| 靖宇县| 平南县| 仁怀市| 门头沟区| 双牌县| 永年县| 安塞县| 内乡县| 开远市| 赞皇县| 托克逊县| 昭觉县| 竹山县| 湘乡市| 那曲县|