ClassDemo08.java
public class ClassDemo08 { private static int a = 0; private int b; public ClassDemo08() { a++; b = 0; } public static double test() { return ((double) a / 10); } public static void main(String[] args) { for (int i = 0; i < 10; i++) { ClassDemo08 d = new ClassDemo08(); System.out.println(); int p1 = ClassDemo08.a; System.out.println(p1); System.out.println(d.b); double p2 = ClassDemo08.test(); System.out.println(p2); System.out.println(); } } } /* 檔名: ClassDemo08.java 作者: Kaiching Chang 時間: September, 2014 */
the end
沒有留言:
張貼留言