常见关键词
关键词static
- memory management purpose
- get memory once(when loaded)
- static property is shared in all onj
- 适用于method, variable, block, class
- static method:
1)can be invoked with our the creation of the instance variable of the class.
2) belongs to the class not to the object of the class.
关键词this
- A reference that refers to an object itself.
- constructor invokesanother constructor under same class.
- current obj/ class
关键词 final
- constant/ permenent value
- 最终值,不可改变
- 修饰class,method, variable
final class ClassName
- 不能被继承,
- 类中成员变量需手动设定,
- 成员方法是final by defualt
final methodName
- 继承类不可以修改final method‘s definition
- 避免 override
- private methods are final by default
final valName
- Reference value 不再指向其他对象
- 指向对象的内容可改变