You need a loop:

for (int i =0; i<numbers.size; i++)
{
   if (comp==numbers[i]) {
       //do your stuff here
   }
}

On Thu, Jul 23, 2009 at 5: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
-~----------~----~----~----~------~----~------~--~---

Reply via email to