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

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

      • <bdo id='nRFrV'></bdo><ul id='nRFrV'></ul>

      1. Java int 部门让我感到困惑

        Java int division confusing me(Java int 部门让我感到困惑)

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

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

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

                  本文介绍了Java int 部门让我感到困惑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在做非常简单的 int 除法,结果很奇怪.

                  I am doing very simple int division and I am getting odd results.

                  此代码按预期打印 2:

                  public static void main(String[] args) {
                      int i = 200;
                      int hundNum = i / 100;
                      System.out.println(hundNum);
                  }
                  

                  此代码将 1 打印为 not 预期:

                  This code prints 1 as not expected:

                  public static void main(String[] args) {
                      int i = 0200;
                      int hundNum = i / 100;
                      System.out.println(hundNum);
                  }
                  

                  这是怎么回事?

                  (Windows XP Pro,Java 1.6 在 Eclipse 3.4.1 中运行)

                  推荐答案

                  0200 是一个 八进制 (base 8) 常量.它等于 128(十进制).

                  The value 0200 is an octal (base 8) constant. It is equal to 128 (decimal).

                  来自 第 3.10.1 节Java 语言规范:

                  八进制数字由一个 ASCII 数字 0 后跟一个或多个 ASCII 数字 0 到 7 组成,可以表示正整数、零整数或负整数.

                  An octal numeral consists of an ASCII digit 0 followed by one or more of the ASCII digits 0 through 7 and can represent a positive, zero, or negative integer.

                  这篇关于Java int 部门让我感到困惑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How to send data to COM PORT using JAVA?(如何使用 JAVA 向 COM PORT 发送数据?)
                  How to make a report page direction to change to quot;rtlquot;?(如何使报表页面方向更改为“rtl?)
                  Use cyrillic .properties file in eclipse project(在 Eclipse 项目中使用西里尔文 .properties 文件)
                  Is there any way to detect an RTL language in Java?(有没有办法在 Java 中检测 RTL 语言?)
                  How to load resource bundle messages from DB in Java?(如何在 Java 中从 DB 加载资源包消息?)
                  How do I change the default locale settings in Java to make them consistent?(如何更改 Java 中的默认语言环境设置以使其保持一致?)
                    <bdo id='t5Hec'></bdo><ul id='t5Hec'></ul>
                    <legend id='t5Hec'><style id='t5Hec'><dir id='t5Hec'><q id='t5Hec'></q></dir></style></legend>
                    • <tfoot id='t5Hec'></tfoot>

                        <tbody id='t5Hec'></tbody>

                    • <small id='t5Hec'></small><noframes id='t5Hec'>

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