天天看點

java關鍵字abstract

abstract

abstract method ,包含abstract method的class必須聲明為abstract

synchronized 标記臨界區,保護共享資源。

Java synchronized keyword marks a block or method a critical section. A critical section is where one and only one thread is executing at a time, and the thread holds the lock for the synchronized section.
public void println(char x[]) {
        synchronized (this) {
            print(x);
            newLine();
        }
    }