You keep updating both high and low inside the run() method, making them by definition not effectively final.

Since you don’t need them outside the run() method anyway, just move the two lines inside.

public void HiLo(int[] numbers){

    Runnable r2 = new Runnable(){
        @Override
        public void run() {
            int high = numbers[0];
            int low = numbers[0];
            System.out.println("The highest value is: ");

Leave a Reply

Your email address will not be published. Required fields are marked *