/**
* Created by rabbit on 2014-07-21.
* final 最终 作为一个修饰符
* 1、可以修饰 类,函数,变量
* 2、被final 修饰的类,函数,变量不能被继承,不能被覆写
*
* */
class demo
{
final int x = 5;
final void show1()
{
System.out.println("show1 running");
}
void show2()
{
System.out.println("show2 running");
}
}
class demo2 extends demo
{
void show2()
{
System.out.println("show2 restart running");
}
}
public class final_Demo {
public static void main(String [] args)
{
demo2 d = new demo2();
d.show2();
System.out.println("final_demo running");
}
}
原文:http://www.cnblogs.com/liupengcheng/p/3857931.html