<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                ## 接口 **課堂代碼:** ~~~java package com.dodoke.demo4; public interface Father { public final static String FAMILY_NAME = "趙"; public void fatherFun(); } ~~~ ~~~java package com.dodoke.demo4; public interface Mather { public final static String FACE = "瓜子臉"; public void matherFun(); } ~~~ ~~~java package com.dodoke.demo4; /** * 接口只能繼承接口,不能繼承類 * @author 一教室 * */ public interface Person extends Father, Mather { /** * 常量 * 抽象方法 */ /** * 雖然可以省略相關修飾符,但是為了代碼的可閱讀性,還是建議加上 */ public static final String PASSWORD = "#123456"; public void eatFood(); public String play(); } ~~~ ~~~java package com.dodoke.demo4; public interface Student { public String a = "5";//雖然因為修飾符的省略,表現形式是成員變量,但實際上還是不可變的常量 public void study(); } ~~~ ~~~java package com.dodoke.demo4; /** * implements表示該類實現某一個接口 * @author 一教室 * */ public class Test implements Person, Student{ public static void main(String[] args) { Test test = new Test(); test.fatherFun(); test.matherFun(); test.eatFood(); test.study(); System.out.println(test.play()); System.out.println(Test.FAMILY_NAME); System.out.println(Test.FACE); System.out.println(Test.PASSWORD); System.out.println(Test.a); /** * 類似于多態的形式,但是Person不是Test的父類。Test是Person的實現類 * 此時聲明變量的類型Person,運行時類型是Person的實現類Test */ Person per = new Test(); //打印出來是Test類中的方法實現內容 per.eatFood(); per.fatherFun(); System.out.println(Person.FAMILY_NAME); } @Override public void fatherFun() { System.out.println("father"); } @Override public void matherFun() { System.out.println("mather"); } @Override public void eatFood() { System.out.println("son"); } @Override public String play() { return "play football"; } @Override public void study() { System.out.println("study"); } } ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看