• <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 超出范围

        The literal xyz of type int is out of range(int 类型的字面量 xyz 超出范围)
            <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 超出范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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 中的默认语言环境设置以使其保持一致?)
                  <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>

                          <tbody id='7J8fW'></tbody>

                          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>