Join Peggy Fisher for an in-depth discussion in this video Avoiding null references, part of Java Essential Training for Students.
- When working with objects, we need to understand…how to test for a null reference,…which is exactly what it sounds like,…a reference to nothing: null.…This happens when you create an object…which creates a variable name…and an address where the data will reside…but it is not then instantiated.…Do you remember what the keyword was for instantiation?…I hope you said new.…That's correct.…For example, if we wanna create an employee object…but we didn't instantiate an address for this employee,…the address would have a value of null.…
Let's see what this looks like.…Let's say we add the address object for the third employee…but we're not sure what it is yet,…so we just set it equal to null for now,…figuring we'll come back and fix it later.…Now we're going to go ahead and create the third employee,…so I do Employee ee3 = new Employee…and this new employee is Jane Smith,…and this is her phone number: 510-555-1212…and her address is a3,…and her employee ID is 456789…and finally, she's in department 001…and her title is Administrator,…
- 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.