摘要: 类体中的方法分为类方法和实例方法。 类方法 用static修饰的方法。 由于类方法是属于整个类的,并不属于类的哪儿个对象,所以类方法的方法体中不能有与类的对象有关的内容。即类方法体有如下限制: 1.类方法中不能引用对象变量; 2.类方法中不能调用类的对象方法; 3.在类方法中不能调使用super,t 阅读全文
posted @ 2020-04-25 20:49 不放弃不疲倦 阅读(3809) 评论(0) 推荐(0)
摘要: 1、(2分) [单选题] 阅读下列程序,选择哪一个是正确的输出结果() A.I’m A class static A I’m B class static B B.static A static B I’m A class I’m B class C.I’m A class I’m B class 阅读全文
posted @ 2020-04-25 20:43 不放弃不疲倦 阅读(581) 评论(0) 推荐(0)
摘要: 父: public class A { public A() { System.out.println("父构造器"); } { System.out.println("父普通块"); } static { System.out.println("父静态块"); } } 子: public clas 阅读全文
posted @ 2020-04-25 20:18 不放弃不疲倦 阅读(95) 评论(0) 推荐(0)