<bdo id='qJGRJ'></bdo><ul id='qJGRJ'></ul>

      <tfoot id='qJGRJ'></tfoot>

    1. <small id='qJGRJ'></small><noframes id='qJGRJ'>

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

        为什么 int j = 012 给出输出 10?

        时间:2023-10-01
            <tfoot id='KNSD4'></tfoot>
                <tbody id='KNSD4'></tbody>

              1. <legend id='KNSD4'><style id='KNSD4'><dir id='KNSD4'><q id='KNSD4'></q></dir></style></legend>

              2. <i id='KNSD4'><tr id='KNSD4'><dt id='KNSD4'><q id='KNSD4'><span id='KNSD4'><b id='KNSD4'><form id='KNSD4'><ins id='KNSD4'></ins><ul id='KNSD4'></ul><sub id='KNSD4'></sub></form><legend id='KNSD4'></legend><bdo id='KNSD4'><pre id='KNSD4'><center id='KNSD4'></center></pre></bdo></b><th id='KNSD4'></th></span></q></dt></tr></i><div id='KNSD4'><tfoot id='KNSD4'></tfoot><dl id='KNSD4'><fieldset id='KNSD4'></fieldset></dl></div>

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

                  <bdo id='KNSD4'></bdo><ul id='KNSD4'></ul>

                  本文介绍了为什么 int j = 012 给出输出 10?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  在我的实际项目中偶然发生的这里是我修改后的小程序.

                  In my actual project It happened accidentally here is my modified small program.

                  我不明白为什么它会输出 10?

                  I can't figure out why it is giving output 10?

                  public class Int
                  {
                      public static void main(String args[])
                      {
                          int j=012;//accidentaly i put zero 
                          System.out.println(j);// prints 10??
                      }
                  }
                  

                  在那之后,我放了两个零,仍然给出输出 10.

                  After that, I put two zeros still giving output 10.

                  然后我将 012 更改为 0123,现在输出 83?

                  Then I change 012 to 0123 and now it is giving output 83?

                  谁能解释一下原因?

                  推荐答案

                  比我把 012 改成 0123 现在输出 83 吗?

                  Than I change 012 to 0123 and now it is giving output 83?

                  因为,它被视为八进制基数 (8),因为该数字的前导是 0.所以,它对应的十进制值为10.

                  Because, it's taken as octal base (8), since that numeral have 0 in leading. So, it's corresponding decimal value is 10.

                  012:

                  (2 * 8 ^ 0) + (1 * 8 ^ 1) = 10
                  

                  0123:

                  (3 * 8 ^ 0) + (2 * 8 ^ 1) + (1 * 8 ^ 2) = 83
                  

                  这篇关于为什么 int j = 012 给出输出 10?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:为什么 == 对于某些 Integer 对象为真? 下一篇:为什么整数除以零 1/0 会出错,但浮点数 1/0.0 返

                  相关文章

                  最新文章

                  1. <legend id='MfXtI'><style id='MfXtI'><dir id='MfXtI'><q id='MfXtI'></q></dir></style></legend>
                    <tfoot id='MfXtI'></tfoot>
                  2. <small id='MfXtI'></small><noframes id='MfXtI'>

                      <bdo id='MfXtI'></bdo><ul id='MfXtI'></ul>

                    1. <i id='MfXtI'><tr id='MfXtI'><dt id='MfXtI'><q id='MfXtI'><span id='MfXtI'><b id='MfXtI'><form id='MfXtI'><ins id='MfXtI'></ins><ul id='MfXtI'></ul><sub id='MfXtI'></sub></form><legend id='MfXtI'></legend><bdo id='MfXtI'><pre id='MfXtI'><center id='MfXtI'></center></pre></bdo></b><th id='MfXtI'></th></span></q></dt></tr></i><div id='MfXtI'><tfoot id='MfXtI'></tfoot><dl id='MfXtI'><fieldset id='MfXtI'></fieldset></dl></div>