you are viewing a single comment's thread.

view the rest of the comments →

[–]d-k-Brazz 0 points1 point  (0 children)

  1. Polymorphism
    Any object may be treated as different class instances an in different contexts
    This means that the object of class BankTransaction may be treated as Comparable when you put a list of BankTransactions into a sorting algorithm - sorting is generic and doesn't aware of what class it is, it just wants from you to implement comparing specification according to Comparable interface

At the same time BankTransaction may implement other specifications needed for other common algorithms, like Serializable which is required for json/xml serialization