You are viewing a single comment's thread. Return to all comments →
WHY WE USE SC.NEXT() IN CATCH PLS EXPLAIN!
if you entered the catch block, an exception has been raised.
most surely, the exception is due to the statement
Hence, you cannot use nextLong() to obtain that large a number.
A different way to obtain this number is to use next(). This function returns the next token as a String (in other words, as is). Since every input is a valid String, this function will not fail and will surely give you the next token (the token you failed to obtain using nextLong()).