add(): This method is available in the java.math.BigInteger class of Java.
Syntax:
BigInteger java.math.BigInteger.add(BigInteger val)
This method takes one argument of type BigInteger. It returns a BigInteger whose value is (this + val).
Parameters: One parameter is required for this method.
val: value to be added to this BigInteger.
Returns: this + val
For Example:
BigInteger bigInteger = new BigInteger("1234")
BigInteger val = new BigInteger("24455")
bigInteger.add(val) = > It returns 25689.
Approach
Java
import java.math.BigInteger;public class BigIntegeradd {public static void main(String[] args) {BigInteger bigInteger = new BigInteger("1234");BigInteger val = new BigInteger("24455");System.out.println(bigInteger.add(val));}}
Output:
25689
No comments:
Post a Comment