BigInteger valueOf 方法找不到符号
BigInteger valueOf method cannot find symbol
我创建了一个包含 BigInteger 对象的数组。当我想将数字分配给数组时,出现找不到符号错误。你能帮助我吗?那是代码:
import java.io.*;
import java.util.*;
import java.math.BigInteger;
public class Solution
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
int t1= in.nextInt();
int t2= in.nextInt();
int n= in.nextInt();
BigInteger[] arr = new BigInteger[n];
arr[0] = new BigInteger.valueOf(t1);
arr[1] = new BigInteger.valueOf(t2);
}
}
输入值为 0 1 5。
这是错误:
Solution.java:15: error: cannot find symbol
arr[0] = new BigInteger.valueOf(t1);
^
symbol: class valueOf
location: class BigInteger
Solution.java:16: error: cannot find symbol
arr[1] = new BigInteger.valueOf(t2);
^
symbol: class valueOf
location: class BigInteger
2 errors
valueOf
是静态方法
arr[0] = BigInteger.valueOf(t1);
我创建了一个包含 BigInteger 对象的数组。当我想将数字分配给数组时,出现找不到符号错误。你能帮助我吗?那是代码:
import java.io.*;
import java.util.*;
import java.math.BigInteger;
public class Solution
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
int t1= in.nextInt();
int t2= in.nextInt();
int n= in.nextInt();
BigInteger[] arr = new BigInteger[n];
arr[0] = new BigInteger.valueOf(t1);
arr[1] = new BigInteger.valueOf(t2);
}
}
输入值为 0 1 5。 这是错误:
Solution.java:15: error: cannot find symbol
arr[0] = new BigInteger.valueOf(t1);
^
symbol: class valueOf
location: class BigInteger
Solution.java:16: error: cannot find symbol
arr[1] = new BigInteger.valueOf(t2);
^
symbol: class valueOf
location: class BigInteger
2 errors
valueOf
是静态方法
arr[0] = BigInteger.valueOf(t1);