Java:大数加法(BigInteger)

import java.math.BigInteger;
import java.util.Scanner;

public class BigAdd {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		String a = in.nextLine();
		String b = in.nextLine();
		String c = new BigInteger(a).add(new BigInteger(b)).toString();
		System.out.println(c);
	}

}

 

你可能感兴趣的:(工具,Java学习之路)