10 2019 档案
摘要://静态属性 static int j; static int s=80; int i; int k=55; /* * 静态代码块 */ static{ j=5; System.out.println("j的初始值为:"+j); } //普通方法 public staticTest() { i=20
阅读全文
摘要:static可以用来修饰类的成员方法、类的成员变量,另外可以编写static代码块来优化程序性能。 static可以修饰 1.方法 2.成员变量(属性) 3.代码块(不能出现在方法内部) 虽然在静态方法中不能访问非静态成员方法和非静态成员变量,但是在非静态成员方法中是可以访问静态成员方法/变量的。
阅读全文

浙公网安备 33010602011771号