Olá!
Onde está o erro, já que no eclipse, v3.2.0, ele indica erro nas linhas 25 e 29, o erro citado:
erro da linha 25:The method printf(String, String, String) is undefined for the type PrintStream
erro da linha 29: The method print(int) in the type PrintStream is not applicable for the arguments (String, int, int)
Segue o código
01 public class InitArray
02 {
03 public static void main(String args[])
04 {
05 // verifica número de argumentos de linha de comando
06 if (args.length != 3)
07 System.out.println(
08 "Error: Please re-enter the entire command, including\n" +
09 "an array size, initial value and increment." );
10 else
11 {
12 // obtém o tamanho do array a partir do primeiro argumento de linha de comando
14 int arrayLength = Integer.parseInt( args[ 0 ] );
15 int array[] = new int[ arrayLength ]; // cria o array
16
17 // obtém o valor inicial e o incremento a partir do argumento de linha de comando
18 int initialValue = Integer.parseInt( args[ 1 ] );
19 int increment = Integer.parseInt( args[ 2 ] );
20
21 // calcula valor de cada elemento do array
22 for ( int counter = 0; counter < array.length; counter++ )
23 array[ counter ] = initialValue + increment * counter;
24
25 System.out.printf( "%s%8s\n", "Index", "Value" );
26
27 // exibe o valor e o índice de array
28 for ( int counter = 0; counter < array.length; counter++ )
29 System.out.print( "%5d%8d\n", counter, array[ counter ] );
30 } // fim de else
31 } // fim de main
32 } // fim da classe InitArray
Obrigado
Abraços
Gaúcho
[size=“11”][color=“red”]* Editado: Lembre-se de utilizar BBCode em seus códigos - Ratinho[/color][/size] :joia: