Discover how the runtime stack helps us trace errors in our programs. Explore a common mistake that many beginner programmers make when using stacks for the first time.
- [Instructor] What else could you use a stack for?…Well they are great for programs…where you need to reverse things.…For example, I am very good at losing things,…and if I could just go back in time and rewind time…and find that lost item, that would be great.…Well, in programming we can.…Inside of a program we can track each step…and ultimately retrace our steps as needed.…So when would you need to retrace your steps…in programming?…Well it would be nice if you could…do that when you get an error, and you can.…
This is where something called the runtime stack,…or call stack, comes in.…The runtime stack keeps track of what variables…you currently have access to…and what subroutine or function you are in.…Whenever you get an error, an error message…coming from the runtime stack usually appears,…and you can retrace your steps…from where the error occurred.…So let's add an error to a program that uses stacks in Java.…The program doesn't have to use stacks,…but since we're talking about them,…let's try it out in Java.…
- Data types: Booleans, numbers, strings, and more
- Multidimensional arrays
- Jagged arrays
- Search and sort arrays
- Linked lists
- Stacks and queues
- Hash functions and hash tables
- Trees and graphs
Skill Level Intermediate
Understand data structures1m 25s
1. Introduction to Data Structures
4. Stacks and Queues
5. Hash-Based Data Structures
6. Trees and Graphs
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
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.