class Demo1_Array
public static void main(String[]args) {
int[ ] arr = {1,2,3,4,5};
int index = (arr,3);
System.out.println(index);
}
public static void getIndex(int [ ] arr,int value) {
for(int i = 0;i < arr.length;a ++) {
if (arr[i] = value) {
return i;
}
}
return -1;
}
}
|