how to read a long value from standard input in java? -


i using util.scanner read input user. don't understand how read long datatype value.

scanner scr=new scanner(system.in); long l=scr.nextint(); 

i unable read 64-bit data using above code — gives me input mismatch exception.

use nextlong method :

long l=scr.nextlong(); 

Comments