• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Answer a programming question, get a tiny bit of fame!

 
Jayesh A Lalwani
Rancher
Pie
Posts: 2756
32
Eclipse IDE Spring Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I guess if you are always taking the bottom pancake out, then you will make the whole stack cooler
 
Ashish Ramteke
Ranch Hand
Posts: 88
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First, a non-technical example
What I thought about is
suppose you have a big garbage-bin, and, you put the big garbage-(eco-friendly)polythene bags in it, one over the other (PUSHING in stack). Then, when those people come for garbage-collection, they take out the latest bags first (POPPING)...

A similar technical example...
Suppose, in some object-oriented programming language X, there is a 'Garbage-collection' mechanism like we have in Java. But, that programming language X, has a feature to Stack (PUSH) each object one over the other as it is created into a Stack, and, just before the program ends, the language has a feature to automatically destroy the objects that were created. For, destroying the objects, it starts from the object which is right at the top of the stack, the newest object created, and first removes it from the Stack (POPs it), and then destroyes it. Similarly, it Pops each object which is at the top.. until the stack of objects' list is empty.

Let me know what do you think..
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic