2016-09-07 19 views
-2

BigIntegerオブジェクトで構成される配列を作成しました。配列に数値を代入したいとき、シンボルエラーが見つかりません。手伝って頂けますか?それはコードです:BigInteger valueOfメソッドがシンボルを見つけることができません

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 

答えて

7

valueOf

arr[0] = BigInteger.valueOf(t1); 
静的メソッドであります
関連する問題