久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    <i id='TPhSe'><tr id='TPhSe'><dt id='TPhSe'><q id='TPhSe'><span id='TPhSe'><b id='TPhSe'><form id='TPhSe'><ins id='TPhSe'></ins><ul id='TPhSe'></ul><sub id='TPhSe'></sub></form><legend id='TPhSe'></legend><bdo id='TPhSe'><pre id='TPhSe'><center id='TPhSe'></center></pre></bdo></b><th id='TPhSe'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='TPhSe'><tfoot id='TPhSe'></tfoot><dl id='TPhSe'><fieldset id='TPhSe'></fieldset></dl></div>

      <small id='TPhSe'></small><noframes id='TPhSe'>

      <tfoot id='TPhSe'></tfoot>

    1. <legend id='TPhSe'><style id='TPhSe'><dir id='TPhSe'><q id='TPhSe'></q></dir></style></legend>
        <bdo id='TPhSe'></bdo><ul id='TPhSe'></ul>
    2. 為什么java在本地時要求初始化變量

      Why java is asking to initialize the variables when it is local(為什么java在本地時要求初始化變量)

        <small id='G09NY'></small><noframes id='G09NY'>

      1. <tfoot id='G09NY'></tfoot>
        <legend id='G09NY'><style id='G09NY'><dir id='G09NY'><q id='G09NY'></q></dir></style></legend>
      2. <i id='G09NY'><tr id='G09NY'><dt id='G09NY'><q id='G09NY'><span id='G09NY'><b id='G09NY'><form id='G09NY'><ins id='G09NY'></ins><ul id='G09NY'></ul><sub id='G09NY'></sub></form><legend id='G09NY'></legend><bdo id='G09NY'><pre id='G09NY'><center id='G09NY'></center></pre></bdo></b><th id='G09NY'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='G09NY'><tfoot id='G09NY'></tfoot><dl id='G09NY'><fieldset id='G09NY'></fieldset></dl></div>
              • <bdo id='G09NY'></bdo><ul id='G09NY'></ul>

                  <tbody id='G09NY'></tbody>
                本文介紹了為什么java在本地時要求初始化變量的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                請看下面的代碼.方法 printTest() 正在打印未初始化變量的默認值,但是當涉及到 main 方法時,java 要求進行變量初始化.誰能解釋一下為什么?

                Please see the code below. The method printTest() is printing the default value of the uninitialized variables but when it's comes to main method java is asking for variable initialization. Can anybody explain why?

                   public class Test1 {
                
                    public static void main(String[] args) {   
                      int j;
                      String t;
                
                      System.out.println(j);
                      System.out.println(t);
                    }
                  }
                
                
                  public class Test2 {
                
                   int i;
                   String test;
                
                  public static void main(String[] args)   {   
                    new Test().printTest();
                  }
                
                   void printTest()   {
                     System.out.println(i);
                     System.out.println(test);
                  }
                
                  }
                

                推薦答案

                局部變量主要用于中間計算,而實例變量應該攜帶用于未來和中間計算的數據.Java 不強制初始化實例變量并允許默認值,但對于局部變量,開發人員調用它來分配值.所以為了避免錯誤,你需要初始化局部變量.

                Local variables are used mostly for intermediate calculations whereas instance variables are supposed to carry data for calculations for future and intermediate as well. Java doesnt forces to initialize instance variable and allows default value but for local variables its the developers call to adssign the value. So to avoid mistakes you need to initialize local variables.

                這篇關于為什么java在本地時要求初始化變量的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                相關文檔推薦

                quot;Char cannot be dereferencedquot; error(“Char 不能被取消引用錯誤)
                Java Switch Statement - Is quot;orquot;/quot;andquot; possible?(Java Switch 語句 - 是“或/“和可能的?)
                Java Replace Character At Specific Position Of String?(Java替換字符串特定位置的字符?)
                What is the type of a ternary expression with int and char operands?(具有 int 和 char 操作數的三元表達式的類型是什么?)
                Read a text file and store every single character occurrence(讀取文本文件并存儲出現的每個字符)
                Why do I need to explicitly cast char primitives on byte and short?(為什么我需要在 byte 和 short 上顯式轉換 char 原語?)
                  <tbody id='yAXDt'></tbody>
                <tfoot id='yAXDt'></tfoot>
                <legend id='yAXDt'><style id='yAXDt'><dir id='yAXDt'><q id='yAXDt'></q></dir></style></legend>
                  • <bdo id='yAXDt'></bdo><ul id='yAXDt'></ul>

                      <i id='yAXDt'><tr id='yAXDt'><dt id='yAXDt'><q id='yAXDt'><span id='yAXDt'><b id='yAXDt'><form id='yAXDt'><ins id='yAXDt'></ins><ul id='yAXDt'></ul><sub id='yAXDt'></sub></form><legend id='yAXDt'></legend><bdo id='yAXDt'><pre id='yAXDt'><center id='yAXDt'></center></pre></bdo></b><th id='yAXDt'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='yAXDt'><tfoot id='yAXDt'></tfoot><dl id='yAXDt'><fieldset id='yAXDt'></fieldset></dl></div>

                      <small id='yAXDt'></small><noframes id='yAXDt'>

                          主站蜘蛛池模板: 97影院2| 久久不卡日韩美女 | 国产成人网 | 亚洲免费毛片 | 亚洲视频一 | 亚洲97| 成人欧美一区二区三区黑人孕妇 | 二区不卡 | 日本三级电影免费观看 | 一区二区国产精品 | 99r在线| 日韩精品一区二区三区在线播放 | 亚洲福利一区二区 | 成人久久久 | 亚洲一区二区三区在线视频 | 日日精品| 日韩一区在线播放 | eeuss国产一区二区三区四区 | 成人精品在线观看 | 亚洲精品日韩在线 | 在线成人免费av | 欧美色图综合网 | 日韩在线观看视频一区 | 国产欧美精品一区二区色综合朱莉 | 精品国产91久久久久久 | 亚洲精品久久久久中文字幕二区 | www.精品国产| 亚洲一区二区精品视频 | 日韩波多野结衣 | 国产精品久久久久久福利一牛影视 | 男女视频91| 国产精品久久久久久久久免费高清 | 成年人免费看 | av天天看| 91精品国产综合久久久动漫日韩 | 五月槐花香 | 一a一片一级一片啪啪 | 看片地址 | 99久久精品国产毛片 | 韩国电影久久 | 午夜精品久久久久久久久久久久久 |