Problem :
Currently I am having issues while figuring out why am I receiving below error
"Local variables referenced from an inner class must be final or effectively final".
My program is running the concurrent threads to sort the array of #'s and then trying to find the high and the low values of my array. When I created my program without the concurrency I was not facing above error. Now I am struggling to know how to finalize the high and low variable.
public void MyHiLo(int[] numbers){
int myhigh = numbers[0];
int mylow = numbers[0];
Runnable myr2 = new Runnable(){
@Override
public void run() {
System.out.println("My highest value is: ");
for (int myindex = 1;my index < numbers.length;myindex++){
if (numbers[myindex] > myhigh)
myhigh = numbers[myindex];
System.out.println(myhigh);
}
.
.
.
.
}
Above block of code is producing the error.