INFO1113×Week5
Lecture
- Part A: Inheritance basics, Encapsulation, Programming Inheritance, Modelling an is-a relationship and UML
- Part B: Method Overloading, Constructor Overloading, try-catch nd exceptions
Inheritance
- Allowing resuability and changes to iherited methods between different types in a hierarchy.
- Syntax: [public] class ClassName extends SuperClassName
- protected access modifier (#): can be accessed by inherited classes
Overloading
- Java: able to use the same method name but with different method signature
- return type is not a part of method signature
Exceptions
- checked exception - try-catch
- unchecked exception (RuntimeException)