iniblock.java
来自「Java面向对象编程(随书配套源代码) 阐述了面向对象编程的思想」· Java 代码 · 共 33 行
JAVA
33 行
package chapter7;
public class IniBlock
{
static int[] staticValues = new int[10];
int[] nonStaticValues = new int[10];
static
{
System.out.println("初时化静态成员:");
for (int i =0;i< staticValues.length;i++)
{
staticValues[i] = (int) (100 * Math.random());
System.out.print(staticValues[i] + ",");
}
}
{
System.out.println();
System.out.println("初时化非静态成员:");
for (int i =0;i< staticValues.length;i++)
{
nonStaticValues[i] = (int) (100 * Math.random());
System.out.print(nonStaticValues[i] + ",");
}
}
public static void main(String [] args)
{
IniBlock ini1 = new IniBlock();
IniBlock ini2 = new IniBlock();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?