Read data from the command line

xiaoxiao2021-03-06  73

Java's newcomer often asked. "How can I read an integer from the command line?" The problem they encountered is double. The first question is that Java regards the command line as a character entered, thanks to "1" instead of 1. The second aspect is to read data from the command line require a very steep learning curve. Fortunately, using a simple Listener system, the slope of the learning curve is reduced and the programmer can focus on the real problem, that is, how to convert the input string into a number.