stack : Java Glossary

*0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ (all)

stack
A stack is a sort of LIFO (Last In First Out) queue. Stacks behave like the stacking trays at a cafeteria. The JVM (Java Virtual Machine) uses a hidden stack to keep track of which method called which method and with what parameters. Every thread has its own private stack of about one megabyte. There is no Collection called Stack, but is fairly easy to write one. Adding to a stack is called pushing and retrieving the top element is called popping. Discarding the top element is called dropping. Duplicating the top element is called duping.

In Forth and PostScript the stacks are explicit. In Java they are hidden, except for printStackTrace.

Local variables are often called stack variables because they are stored on the stack. In Java, the stack contains the local variables for each running method is the thread and the places to return to in the calling program for each level of call. If you call too many methods without returning (usually by using recursion) you will generate a StackOverFlowError.


This page is posted
on the web at:

http://mindprod.com/jgloss/stack.html

Optional Replicator mirror
of mindprod.com
on local hard disk J:

J:\mindprod\jgloss\stack.html
Canadian Mind Products
Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.

IP:[65.110.21.43]
Your face IP:[3.17.154.171]
You are visitor number