0
how can I test a variable against everything in my array
title
4 Respostas
+ 2
public class Program
{
public static void main(String[] args) {
int[] ary = {3,6,5,9};
for(int i : ary){
if(i == 5){
System.out.println("found");
break;
}
}
}
}
+ 2
I just wanted a basic example of how one would compare a integer variable against a group of integers and tiger gave me what I needed
+ 1
using loop
0
Tiger your answer cant be 100% right since the person who posted this question didnt mention what type of array it is, it could be comparing an object against another collection of objects within the array and so forth. Finally the person who posted it please post a fully detailed question and provide an example for people to really help you. Thanks!