Join Peggy Fisher for an in-depth discussion in this video Challenge: Loading a file, part of Up and Running with Java.
- For this challenge, we're going to practice…reading and writing from files.…We'll read in the list of menu items from a file…created by a local restaurant.…It contains one item per line,…such as: french fries, hamburger,…soda, et cetera.…Make sure you save the file in the project folder…with the build.xml file.…You can create the file using either Notepad or Notepad++.…Also, don't forget to include your error-handling logic.…This is really important when you're trying to read…from a file, because if the file is not found,…you'll want to catch that error…rather than having your program end abruptly.…
We're going to read each item from the file,…then ask the user to give the price for each item…and write out the menu item with the price,…separate it with a Tab, Escape sequence,…which is a /T,…to a separate output file.…I've estimated 20 minutes for this activity,…so go ahead and give it a try.…
- Downloading and exploring NetBeans
- Understanding Java basics: data types, strings, arrays, and more
- Controlling flow with functions and loops
- Creating classes
- Sorting and searching arrays
- Manipulating files
- Handling errors
- Building GUIs
Skill Level Beginner
1. Getting Started
2. Java Basics
3. Flow of Control
4. Classes and Objects
5. Beyond the Basics
6. File Manipulation
7. Graphical User Interface Basics
- 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.