摘要:
} public class Test { private static int n = 0; public Test() { n++; } public static int getNum() { return n; } public static void main(String[] args) 阅读全文
posted @ 2019-10-18 17:36
明月照我还
阅读(112)
评论(0)
推荐(0)
摘要:
public class Me { int x=1; static int y=2; public static void method()//静态方法 { System.out.println("实例变量x = " + new Test().x);//在静态方法中访问类的实例变量需首先进行类的实例 阅读全文
posted @ 2019-10-18 09:30
明月照我还
阅读(376)
评论(0)
推荐(0)
摘要:
无法通过编译,如果系统提供了一个自定义的构造方法,将导致系统不再提供默认构造方法 阅读全文
posted @ 2019-10-18 09:27
明月照我还
阅读(200)
评论(0)
推荐(0)
摘要:
class Root{ static{ System.out.println("Root的静态初始化块"); } { System.out.println("Root的普通初始化块"); } public Root() { System.out.println("Root的无参数的构造器"); }} 阅读全文
posted @ 2019-10-18 09:22
明月照我还
阅读(116)
评论(0)
推荐(0)

浙公网安备 33010602011771号