Hello again!

This is the second part of the blog series about how the book “Effective Java” may have influenced Kotlin’s design. Before continuing, take a look on the first part if you have not already read it.

Let’s continue!


6. Final classes by default

Item 17 in “Effective Java” suggests that every class should either not be sub-classable or be carefully designed and documented to support inheritance. In Java, every class can be subclassed unless you explicitly specify the class as final. If you forget to make the class final and fail to design and document it for inheritance, there will be trouble when clients think that they can create subclasses, override some methods and assume that everything will still work as expected.

Continue reading