View RSS Feed

Recent Blogs Posts

  1. Implementing a Stack in Java

    by , 02-19-2012 at 07:13 AM
    This post will be explaining the Java’s Stack implementation. Last in first order policy is used in Stack in which one by one elements get inserted in a sequence which could be retrieved later on in reverse order. Use these 2 methods to insert or read the elements to/from the Stack.

    • Pop()
    • Push()

    Code is given below to show the implementation of LIFP stack. Total elements that are needed to be inserted to Stack will be taken and after which it will be asked ...
    Tags: java stack Add / Edit Tags
    Categories
    Stack
  2. Java stack and heap memory

    by , 01-08-2012 at 11:43 AM
    Heap is used to store new objects created by Java. Stack is used to store primitive data types like int and double when they are declared locally. These primitive data types are stored on heap when they are declared globally. Whenever a Java method is called, all the local variables are pushed to stack and its pointer is decremented after completion of that method call. In a multithreaded application only one heap is used and each thread contains its own stack. So do not declare your data globally ...
    Categories
    Stack