provide the array index like comp == numbers[0], better still have a for loop 
as 
 
for (int i = 0; i < numbers.length; i++){
    if (comp == numbers[i]){
         //do your logic
   }
}
 


--- On Thu, 7/23/09, nguyen thanh lam <[email protected]> wrote:


From: nguyen thanh lam <[email protected]>
Subject: [java programming] compare an int
To: "Free Java Programming Online Training Course By Sang Shin" 
<[email protected]>
Date: Thursday, July 23, 2009, 2:57 AM



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