Parameter 0: stringA Parameter 1: stringB Parameter 2: stringC
The command line data are
always Strings.
But this does not prevent you
from entering numbers.
As with run-time input from
the keyboard you use
Integer.parseInt(String)
Double.parseDouble(String)
class InputDemo { public static void main ( String[] args ) { int sum = 0; for (int j=0; j < args.length; j++ ) sum += Integer.parseInt( _______________ ); System.out.println( "Sum: " + sum ); } }
Say that the user started this program with the command line:
C:\>java InputDemo 23 87 13 67 -42