Java examples for Language Basics:try catch finally
Catching multiple exception types to improve type checking
import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; import java.nio.file.Files; import java.nio.file.Paths; public class Main { public static void main(String[] args) { try {/*from ww w.ja va2 s . co m*/ Files.delete(Paths.get(new URI("file:///tmp.txt"))); } catch (URISyntaxException ex) { ex.printStackTrace(); } catch (IOException ex) { ex.printStackTrace(); } } }