Why age entering by user is in string?
Why we have to take String as variable for input a number? Why not take a int for readLine?
Jennifer NordellTreehouse Staff
Hi there! Cevin Thomas is 100% correct. Anything coming in from the console/command line will be a String. It's interesting to note that this is not exclusive to Java. This applies to just about every programming language I've ever come across. In fact, I can't remember any programming language where the input from the user comes in as anything other than a String. So when you get in the input, if it needs to be an integer, there will also need to be some sort of parsing done. This is true for at least Java, ANSI C/C++/C#, and I believe it also to be true for Python and Ruby.
Hope this helps!