Checked vs unchecked exceptions
public static void main(String[] args) {
final Path
sourcePath = Paths.get("/tmp/test.txt"),
destPath = Paths.get("/tmp/copy.java");
// Compile time error:
// Unhandled exception:
java.io.IOException
Files.copy(sourcePath, destPath);
... |
public static void
main(String[] args) {
final String s = null;
// No problem
System.out.println(s.length()); |