
ClassDemo08.java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | 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

沒有留言:
張貼留言