fiz*_*fiz 4 java int type-conversion long-integer
我试图将long值传递给该方法并在那里使用它来创建一个Long Array.但是,我在创建数组时遇到"可能从long转换为int"的错误
long[] array = new long[n];
Run Code Online (Sandbox Code Playgroud)
虽然我没有使用任何整数值.
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;
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4577 次 |
| 最近记录: |