iconstd.java
来自「压缩包内是近180多个针对Java初学者编写的简单实例」· Java 代码 · 共 20 行
JAVA
20 行
// An interface that contains constants.
interface IConst {
int ARRAYSTAR = 0;
int ARRAYEND = 10;
String ERRORMSG = " ERROR! OVER ARRAY NUMBERS! ";
}
class IConstD implements IConst {
public static void main(String args[]) {
int nums[] = new int[ARRAYEND];
for(int i= ARRAYSTAR; i < 11; i++) {
if(i >= ARRAYEND) System.out.println(ERRORMSG);
else {
nums[i] = i;
System.out.print(nums[i] + " ");
}
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?