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

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

  • <tfoot id='x3iCx'></tfoot>

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

        int 类型的字面量 xyz 超出范围

        时间:2023-05-29
            <bdo id='W2vVL'></bdo><ul id='W2vVL'></ul>
            <legend id='W2vVL'><style id='W2vVL'><dir id='W2vVL'><q id='W2vVL'></q></dir></style></legend>

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

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

                    <tbody id='W2vVL'></tbody>

                1. 本文介绍了int 类型的字面量 xyz 超出范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我目前正在使用 Java 中的数据类型,如果我理解正确,类型 long 接受介于 -9,223,372,036,854,775,808 到 +9,223,372,036,854,775,807 之间的值.现在正如您在下面看到的,我创建了一个名为 testLonglong 变量,尽管当我插入 9223372036854775807 作为值时,我收到一条错误消息:

                  I am working with data types at the moment in Java, and if I have understood correctly the type long accepts a value between the ranges of -9,223,372,036,854,775,808 to +9,223,372,036,854,775,807. Now as you can see below, I have create a long variable called testLong, although when I insert 9223372036854775807 as the value, I get an error stating:

                  int 类型的字面量 9223372036854775807 超出范围.

                  The literal 9223372036854775807 of the type int is out of range.

                  我不知道为什么它把 long 数据类型称为 int.

                  I don't know why it is referring to the long data type as an int.

                  有人有什么想法吗?

                  代码:

                  char testChar = 01;
                  byte testByte = -128;
                  int testInt = -2147483648;
                  short testShort = -32768;
                  long testLong = 9223372036854775807;
                  float testFoat;
                  double testDouble = 4.940656458412;
                  boolean testBool = true;
                  

                  推荐答案

                  在末尾加一个大写的L:

                  long value = 9223372036854775807L;
                  

                  否则,编译器将尝试将文字解析为 int,因此会出现错误消息

                  Otherwise, the compiler will try to parse the literal as an int, hence the error message

                  这篇关于int 类型的字面量 xyz 超出范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:value &amp; 是什么意思?0xff 在 Java 中做什么? 下一篇:为什么Java除以0.0时不抛出异常?

                  相关文章

                  <legend id='7J8fW'><style id='7J8fW'><dir id='7J8fW'><q id='7J8fW'></q></dir></style></legend>

                    <bdo id='7J8fW'></bdo><ul id='7J8fW'></ul>
                  <tfoot id='7J8fW'></tfoot>

                    1. <small id='7J8fW'></small><noframes id='7J8fW'>

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