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 - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -