摘要:
1.今天学习了final关键字。 使用final修饰类,代表该类是不能被继承的,final修饰方法,表示该方法不能被重写,final修饰变量,代表该变量是常量。 例如用final修饰属性: public class FinalVarDemo{ private static final int x=5 阅读全文
摘要:
1.今天学习了java中的动态绑定,动态绑定具体表现在向上转型上,因为只有在运行时才知道具体运行的是哪个实例。 示例: public class Father{ public void say(){ System.out.println("father say()"); } public stati 阅读全文
摘要:
1.今天学习了多态中的覆盖。 覆盖是指子类重写父类的方法,例子如下: public class Father{ public void say(){ System. out. println("father say()"); } public static void main(String[] ar 阅读全文