how to input a BigInteger type in java

前端 未结 5 1223
抹茶落季
抹茶落季 2020-12-31 13:34

when I tried to get an input of type Integer, what I only needed to do was the code below.

Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
         


        
5条回答
  •  情歌与酒
    2020-12-31 14:20

    Scanner sc = new Scanner(System.in);
    BigInteger b = new BigInteger(sc.next());
    

    There is also:

    BigInteger b = sc.nextBigInteger();
    

提交回复
热议问题