intcell.java
来自「Data StructuresAnd Algorithm Analysis In」· Java 代码 · 共 37 行
JAVA
37 行
/**
* A class for simulating an integer memory cell.
* @author Mark A. Weiss
*/
public class IntCell
{
/**
* Construct the IntCell.
* Initial value is 0.
*/
public IntCell( )
{ this( 0 ); }
/**
* Construct the IntCell.
* @param initialValue the initial value.
*/
public IntCell( int initialValue )
{ storedValue = initialValue; }
/**
* Get the stored value.
* @return the stored value.
*/
public int read( )
{ return storedValue; }
/**
* Store a value
* @param x the number to store.
*/
public void write( int x )
{ storedValue = x; }
private int storedValue;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?