📄 sharedobject.java
字号:
public class SharedObject{ // The private shared data variable private Integer sharedData = null; // Default Constructor public SharedObject( int initialValue ) { super(); // Initialize the shared object value to something sharedData = new Integer( initialValue ); } // The produced will call this method to update the data public synchronized void setSharedData( int newData ) { System.out.println( "Shared Object - New Value Set: " + newData ); sharedData = new Integer( newData ); } // The consumer will call this method to get the new data public synchronized Integer getSharedData() { return sharedData; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -