我想尝试使用令牌并使某些代码行只读。例如;
class DeclareVarInit {
// declare constants
// DEDUCTION to be 2000 and
// TAX_RATE to be 0.2
//
public static void main(String[] args) {
// variables
double incomeTax, taxableIncome, grossSalary;
//declare numOfChildren and initialize to 2
//declare numOfParents and initialize to 2
int numOfDependents;
// assignment statements
grossSalary = 100000;
numOfDependents = numOfChildren + numOfParents;
taxableIncome = grossSalary - numOfDependents*DEDUCTION;
incomeTax = taxableIncome * TAX_RATE;
System.out.println("The income tax is " + incomeTax);
} }
我想让注释行 // 可编辑,其余为只读。我在这方面完全是菜鸟,所以我需要一些帮助。非常感谢。