<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>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                【1】類的組成:屬性,方法,構造器,代碼塊,內部類 【2】代碼塊分類:普通塊,構造塊,靜態塊,同步塊(多線程) 【3】代碼: ``` package com.msb6; /** * @Auther: msb-zhaoss */ public class Test { //屬性 int a; static int sa; //方法 public void a(){ System.out.println("-----a"); { //普通塊限制了局部變量的作用范圍 System.out.println("這是普通塊"); System.out.println("----000000"); int num = 10; System.out.println(num); } //System.out.println(num); //if(){} //while(){} } public static void b(){ System.out.println("------b"); } //構造塊 { System.out.println("------這是構造塊"); } //靜態塊 static{ System.out.println("-----這是靜態塊"); //在靜態塊中只能方法:靜態屬性,靜態方法 System.out.println(sa); b(); } //構造器 public Test(){ System.out.println("這是空構造器"); } public Test(int a){ this.a = a; } //這是一個main方法,是程序的入口: public static void main(String[] args) { Test t = new Test(); t.a(); Test t2 = new Test(); t2.a(); } } ``` 總結: (1)代碼塊執行順序: 最先執行靜態塊,只在類加載的時候執行一次,所以一般以后實戰寫項目:創建工廠,數據庫的初始化信息都放入靜態塊。 一般用于執行一些全局性的初始化操作。 再執行構造塊,(不常用) 再執行構造器, 再執行方法中的普通塊。 ![](https://img.kancloud.cn/49/10/4910ff3d8d85d28161011cd96c3115eb_3486x1173.png) ![](https://img.kancloud.cn/ba/e2/bae2b34631b401aa721bf7e65f618fea_2704x1779.png) ![](https://img.kancloud.cn/4a/4b/4a4b78eac163397a055e86b5c3e2a979_2113x1812.png)
                  <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>

                              哎呀哎呀视频在线观看