20 - Command Line Arguments | Java Tutorials

preview_player
Показать описание
Input data into your code through the main method string arguments when you run your class file. Also shows a foreach loop example.

| Language
Java (.java /.class)

| Code Example
Рекомендации по теме
Комментарии
Автор

Integer.parseInt(string); //The best possible way!
Integer.valueOf(string); //It returns an object (Integer) not a raw type (int)!
Integer.decode(string); //It can decode from BIN, HEX and OCT as well as DEC format!
NumberUtils.toInt(string); //It can be imported from

P.S. Casting a string to an int (e.g. (int)string) will not compile!

coopjmz
welcome to shbcf.ru