java - Converting character inputs into numerical variables -


consider following input example:

user_input> x

which read following code:

scanner scan= new scanner(system.in);  string s = scan.nextline(); 

is possible declare numerical variable has same name of string read?

in order convert string integer, use integer.parseint() method.

for long types, long.parselong(). , on.


Comments

Popular posts from this blog

javascript - ScrollTo Effect (href to div) -

javascript - ng-class not responding to change in model in Angular? -

javascript - document.registerElement extending HTMLInputElement prototype while using custom tag name to avoid implicit browser style -