you can compare the comp with in a loop with all the items of the
"numbers" array:
for (int i = 0 ; i < numbers.Length; i++)
{
if (comp == numbers[i]){
//do what ever you want in case of equal
}else{
//do what ever you want is case of not equals
}
}
On Jul 23, 12:57 pm, nguyen thanh lam <[email protected]> wrote:
> Int numbers={1,2,3,4,5}
> int comp;
> if (comp == numbers[] ) // <==error here (" cannot compare int with
> int[] ")
>
> I want to compare a variable with many others. how i should do?
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---