搓搓的代码 import java.util.ArrayList; import java.util.Iterator; class Student{ private static int num; private String name; private int age; private int number; public Student(){} public Student(String name,int age) { num++; this.number=num; this.name=n…
Java中static块执行时机 演示例子 在使用static进行初始化的操作,怎么也执行不了!代码如下: public class StaticDemo { public static final String INIT = "init"; static { System.out.println("------StaticDemo----"); } } public class TestStatic { public static void main(String…
转自:http://advance0683.iteye.com/blog/1107732 Java中static final 与 final 的区别: 例子: Java代码 import java.util.Random; //这个例子想说明一下static final 与 final的区别 public class StaticAndFinalTest { ); //47作为随机种子,为的就是产生随机数. ); ); public static void main(String[] args)…