Join Todd Perkins for an in-depth discussion in this video Handle Java errors, part of Learning Java Applications (2016).
- [Voiceover] So let's look at handling errors in Java.…So here I have some code that loads a file…and closes out the FileReader.…It throws an IOException.…So we have two main ways of handling errors.…We can have the method that we're running the code in…that could possibly create an error, throw an exception…or we can handle it using a try-catch block.…So let's see what happens when our hello file is not there…because I've actually deleted the file so it's no longer…in the Package Explorer.…
I run the application and I'm seeing this error here.…So it says there's an exception in thread main, hello…no such file or directory.…So let's see what happens differently if we handle it…in a try-catch block.…So I'm going to delete the throws IOException…and I'm going to handle the error myself.…So I'm going to try and wrap all of this code…in curly braces and I'll indent it so it's easier to read…and then in here we can catch the error.…
So we'll catch IOException, we'll call this error…and then we'll just print out the error that we get.…
- Installing Java and Eclipse
- Understanding basic Java syntax
- Handling Java errors
- Creating a UI with Swing
- Creating tables and connecting to data sources for tables
- Publishing a JAR file
- Installing NetBeans
- Creating JSP pages
- Setting up and connecting to databases
- Creating Java-based Android Studio projects
Skill Level Beginner
1. Install Java and an IDE
2. Java Basics Review
3. Create a User Interface with Swing
4. Tables and Data Sources
5. Application Distribution and Deployment
Publish a runnable JAR file2m 32s
6. Server-Side Java: JSP and Databases
7. Android Development
Next steps1m 16s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.