Код класса runnable ниже, вопрос, почему этот код вообще работает? у нас есть переменная boolean isCurrentThreadInterrupted которой мы один раз до цикла while присвоили корректное значение, почему при вызове thread.interrupt() значение этой примитивной переменной равно Thread.currentThread().isInterrupted() как будто в самом цикле while мы присваиваем постоянно isCurrentThreadInterrupted = Thread.currentThread().isInterrupted(); но мы делаем это 1 раз до цикла.
public void run() {
           //fix 2 variables - исправь 2 переменных
           boolean isCurrentThreadInterrupted = Thread.currentThread().isInterrupted();
           String threadName = Thread.currentThread().getName();

           try {
              // while (!(isCurrentThreadInterrupted = Thread.currentThread().isInterrupted())) {
               while (!isCurrentThreadInterrupted){

                   System.out.println("Объект " + sharedResource + ", нить " + threadName);
                   Thread.sleep(1000);
               }
           } catch (InterruptedException e) {
           }