Java OOD notes

Posted by Rain on April 15, 2020

Container Class

  • ArrayList notes = new ArrayList; - notes.add(); -

  • A Container Class has 2 type:
  • container type
  • element type

Muititype(多态)

  • declaration type(声明类型)
  • denamic type(动态类型)

### 函数调用的绑定

  • 静态绑定
  • 动态绑定

覆盖 override

Object 类

  • 单根结构 object 类 ### object 类的函数
  • toString() //eclipse has generate tostring function

  • equals() reason: we didn’t define our own equals()

设计原则

消除代码重复

用封装来降低耦合