I was coding and testing out a simple thread application when I realised that for some reason the program does not enter the for loop when it's supposed to. I am not sure why. I have placed print statements at selected points in both the java files to monitor the program flow, I can safely say the program execution goes all the way into the run method, but not into the for loop within the run method. I am not sure why, to me everything seems to be in order. Hope some can advise. Thanks.
I checked your code and found that Finder class constructor needs a change
your original constructor is :
Finder(int target, int begin, int end)
target = target;
begin = begin;
end = end;
here, you should initialize the field members begin and end as follows :
this.begin = begin;
this.end = end;
this will initialize your class field members begin and end which you are using in run method.
currently what is happening is, local variables begin and end of the constructor are getting initialized and so when run method is accessing the begin and end field members for the For loop, it is getting 0 values for both since they were not initialized through constructor.