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

        <legend id='ZZ8xW'><style id='ZZ8xW'><dir id='ZZ8xW'><q id='ZZ8xW'></q></dir></style></legend>
      3. 从long到int的可能有损转换,JAVA

        时间:2023-07-27

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

            <tbody id='TwT33'></tbody>

            <bdo id='TwT33'></bdo><ul id='TwT33'></ul>
              1. <small id='TwT33'></small><noframes id='TwT33'>

                  本文介绍了从long到int的可能有损转换,JAVA的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  I am trying to pass long value to the method and use it there to create a Long Array. However, I am getting "possible lossy conversion from long to int" error while creating an array

                  long[] array = new long[n];
                  

                  although I have not used any integers values.

                  import java.util.Scanner;
                  import java.util.ArrayList;
                  
                  public class test{
                  public static void main(String[] args){
                      Scanner input = new Scanner(System.in);
                      long n = input.nextLong();
                  
                      System.out. although("result is " + n + " is " + testing(n));
                  }
                  
                  private static long testing(long n){
                      long[] array = new long[n];
                  
                      return 0;
                    }
                  }
                  

                  解决方案

                  Array dimensions can only be int types. The compiler is expecting that type but you are passing in a long type. You could change the argument type being passed in to an int and the make the corresponding changes.

                  For completeness, here is what the JLS says about variables in an array

                  they are referenced by array access expressions that use non-negative integer index values.

                  这篇关于从long到int的可能有损转换,JAVA的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:存储 20 位数字的数据类型 下一篇:将 char 传递给带有 int 参数的方法

                  相关文章

                  最新文章

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

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