1
2
3
4
5
try {
    File.open("crumpets.txt");
} catch (Exception e) {
    //The File class threw an exception when opening the file went wrong.
}