<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.demo3; /** * 定義抽象類 * 在抽象類中,可以沒有抽象方法 * 但是如果在一個類中有抽象方法,那么該類必須用abstract修飾 * @author 一教室 * */ public abstract class Person { public String name; public int age; public int sex; public static String test = "2";//static 修飾的靜態變量也能被繼承 /** * The abstract method say in type Person can only be defined by an abstract class * 如果在一個類中定義抽象方法,那么該類必須首先定義為抽象類 * 抽象方法是沒有大括號和方法體的 */ public abstract void say(); //The abstract method talk in type Person can only set a visibility modifier, one of public or protected //private abstract void talk();錯誤的,不能用private修飾 //abstract void talk();正確的,可以用default修飾 //public abstract static void tell();錯誤的,不能用static修飾 public Person(String name, int age, int sex) { super(); this.name = name; this.age = age; this.sex = sex; } public Person() { super(); } } ~~~ ~~~java package com.dodoke.demo3; /** * The type GaoJunNan must implement the inherited abstract method Person.talk() * 當一個類繼承了抽象類,就必須去重寫抽象類中的抽象方法 * @author 一教室 * */ public class GaoJunNan extends Person{ private boolean isMarry; public boolean isMarry() { return isMarry; } public void setMarry(boolean isMarry) { this.isMarry = isMarry; } public GaoJunNan() { super(); } public GaoJunNan(String name, int age, int sex, boolean isMarry) { super(name, age, sex); this.isMarry = isMarry; } public static void main(String[] args) { //Person per = new Person();無法實例化抽象類person GaoJunNan gjn = new GaoJunNan("高俊楠", 24, 1, false); System.out.println(gjn.name); System.out.println(GaoJunNan.test); gjn.say(); } /** * 強制性的要求重寫抽象方法 */ @Override public void say() { System.out.println("高俊楠說中文"); } } ~~~
                  <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>

                              哎呀哎呀视频在线观看