Can I pass number greater than 999 999 999 as parameter in java.
When I do like this it gives compiler error the literal 999 999 999 9 of type is out of range
passNumber(9999999999);
public String passNumber(long number){
if(number > 999999999)
throw new BigNumberException("Number too large")
}
It’s because 9,999,999,999 is considered as an
intby the compiler and is larger thanInteger.MAX_VALUE(2,147,483,647).You can use a
long:9999999999L.