Synchronized blocks

Report a typo

Here is a class named SomeClass:

class SomeClass {

    val LOCK_1 = Any()
    val LOCK_2 = Any()

    fun method1() {
        synchronized(LOCK_1) {
            //synchronized block 1
            method3()
        }
    }

    fun method2() {
        
        // do something useful

        synchronized(LOCK_2) {
            //synchronized block 2
            method3()
        }
    }

    @Synchronized
    fun method3() {
        // do something useful
    }
}

Select all correct statements:

Select one or more options from the list
___

Create a free account to access the full topic