Day 6
Objectives:
Objectives:
- Interfaces
- Exception Handling
Lab assignment:
Lab assignment:
- Finish all the practice exercises of Days 1-5
- Exercises for Day 6
pdf file: Practice Exercises for Day 6
Lecture slides:
Lecture slides:
- pdf file: Slides for Day 6
- files (Employees-Expenses project, interfaces): Employee.java, Expense.java, ExpenseInterfaceTest.java, HourlyEmployee.java, MaintenanceCost.java
- files (Rational project, exception handling): Rational.java, RationalTest.java
- useful links: Abstract classes compared to Interfaces (by Oracle)
- A very good example of interface (by Charlton Smith): Main.java
Although in this example it is possible to use abstract class (in comparison to the Carbon Footprint - where the interface is 100% strategy to use), it seems that it is a trend in Java to do as much as possible via interfaces.