运行效果:
控制台效果:
==================================================
代码部分
==================================================
/hello_test/src/com/b510/test/StaticTest.java
复制代码 代码如下:
package com.b510.test;
public class StaticTest {
private static int staticInt = 2;
private int random = 2;
public StaticTest() {
staticInt++;
random++;
System.out.println("staticInt = "+staticInt+" random = "+random);
}
public static void main(String[] args) {
StaticTest test = new StaticTest();
StaticTest test2 = new StaticTest();
}
}



