how to insert values into an array?

after having declared an array

how to store values we are given trhu keyboard ?

This one is nt working !!

String S ="";//8

int j;int i,min,posmin;

i=0;

posmin=1;

BufferedReader clavier =

new BufferedReader(

new InputStreamReader(System.in));

Integer [] num = new Integer[25];

System.out.println("Entrer 10 numeros ");

for( j=0;j<10;j++)

{

S = clavier.readLine();

num[j] = Integer.valueOf( S);

System.out.println(num[j]);

}

min=num;

for( j=0;j<=10;j++)

{

if(num<min)

{

min=num;

posmin=posmin+1;

}

else

continue;

}

System.out.println("Le minimum est "+ min);

System.out.println("Et sa position dans le tableau est" + posmin);>

[849 byte] By [roseddeeepssa] at [2007-10-2 10:39:20]
# 1

after the first loop, you're trying to assign an array of Integers to an int.

I think you mean :

// ...

posmin = 0;

min = num[posmin];

for (j = 0; j < 10; ++j) { // '<' and not '<=', or you'll be reading 11 values

if (num[j] < min) {

min = num[j];

posmin = j;

}

// the 'else { continue; }' is not needed, you "continue" anyway

}

Torajiroua at 2007-7-13 2:45:12 > top of Java-index,Java Essentials,New To Java...