October 2018
Intermediate to advanced
370 pages
9h 15m
English
Checked exceptions force handling, even if we don't need this. This is the root of many problems and that's why Kotlin doesn't have checked exceptions. Let's imagine that we want to implement our own class for logging that implements the Appendable interface from the java.lang package:
class Logger implements Appendable { @Override public Appendable append(CharSequence csq) throws IOException { throw new NotImplementedException(); } @Override public Appendable append(CharSequence csq, int start, int end) throws IOException { throw new NotImplementedException(); } @Override public Appendable append(char c) throws IOException { throw new NotImplementedException(); }}
We can use this class to print logs as follows:
public ...Read now
Unlock full access