最近2018中文字幕在日韩欧美国产成人片_国产日韩精品一区二区在线_在线观看成年美女黄网色视频_国产精品一区三区五区_国产精彩刺激乱对白_看黄色黄大色黄片免费_人人超碰自拍cao_国产高清av在线_亚洲精品电影av_日韩美女尤物视频网站

RELATEED CONSULTING
相關咨詢
選擇下列產(chǎn)品馬上在線溝通
服務時間:8:30-17:00
你可能遇到了下面的問題
關閉右側工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
java中的interface接口實例詳解-創(chuàng)新互聯(lián)

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

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

 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)
URL分享:http://fisionsoft.com.cn/article/dpship.html