Static Synchronized - Java Quiz Question


What will be output of the following program?

public class Employee {
    public static void main(String[] args) {
        for (int i = 1; i < 3; i++) {
            CheckingSpot t = new CheckingSpot();
            t.setName("Person-" + i);
            t.start();
        }
    }
}
class Office {
    static synchronized void userAction() {
        System.out.println(Thread.currentThread().getName() + " login.");
        System.out.println("Work Started.");
        try {
            Thread.sleep(400);
        } catch (Exception e) {
            System.out.println("Thread Interrupted.");
        }
        System.out.println(Thread.currentThread().getName() + " logout.");
        System.out.println("----------------");
    }
}
class CheckingSpot extends Thread {
    public void run() {
        Office.userAction();
    }
}


A
Person-1 login.
Work Started.
Person-1 logout.
----------------
Person-2 login.
Work Started.
Person-2 logout.
----------------
B
Person-1 login.
Person-2 login.
Work Started.
Work Started.
Person-1 logout.
----------------
Person-2 logout.
----------------
C
Person-2 login.
Work Started.
Person-1 login.
Work Started.
Person-2 logout.
----------------
Person-1 logout.
----------------
D
Output can not be determined
E
Compilation Error or Runtime Error