- When programming, it's really important…to remember that you have to account…for potential user errors.…Most programming languages have code…that helps handle unexpected errors.…It provides the programmer control…over the exception so they can provide…meaningful messages and avoid program interruptions.…This program reads a series of numbers from a text file.…I created a text file in the IDE called "numbers.txt"…and added a few numbers.…The program is designed to read the numbers…and at the end of file, it will calculate…the average of the numbers.…
Let's take a look at the program…and the error logic that I added…for both any "Input File Errors" that might occur and any…potential "Null Pointer Exceptions" that might occur.…At the top of the program you can see…I had to import the java.io to get the library…that allows me to read and write from files…and the java.util because I need…to use the scanner object.…Let's start by looking at line 17.…We have our normal "public static void main"…but now we've added something that says…
- Getting started with parsing
- Reviewing data types
- Using decisions
- Creating user-defined methods
- Command-line debugging
- Exploring the Java API
- Creating and instantiating classes
- Working with interfaces
- Storing items with arrays
Skill Level Intermediate
Q: How can I make my debugger function like the author’s?
1. Command Level Programming
2. Basics Review
4. Java API
5. Simulations and Algorithm Analysis
6. Classes and Objects
7. More on Classes
8. Data Structures
- 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.