variable.java

来自「一种CMM语言的词法分析」· Java 代码 · 共 38 行

JAVA
38
字号
/*
*  吕渊 200532580144
*  使用工具:eclipse
*  Java SE 6
*/
//存储int型变量的类
public final class Variable {
	//int型变量名
	protected String name = "";
	//时候初始化
	protected boolean evaluated = false;
	//变量值
	protected int value = 0;
	
	//不进行初始化的构造方法
	public Variable(String name) {
		this.name = name;
	}
	
	//进行初始化的构造方法
	public Variable(String name, int value) {
		this.name = name;
		this.value = value;
		this.evaluated = true;
	}
	
	//设置变量值
	public void setValue(int value) {
		this.value = value;
		this.evaluated = true;
	}
	
	//获取变量值
	public int getValue() {
		return value;
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?