Stack
      In this program a stack is implemented in very easy and efficient manner. A stack is a collection of items in Lifo order.
public class Stack 
{
	int arr[100];
	int top;
	int full;

	Stack()
	{
		top = -1;
		full = 100;
	}

	void push(int a)
	{
		if(top==full-1)
		{
			System.out.println("the stack is full");
		}

		else
		{
			top++;
			arr[top]=a;
		}
	}

	int pop()
	{
		int i;

		if(top==-1)
		{
			System.out.println("the stack is empty");
		}
		else
		{
			i = arr[top];
			top--;
			return i;
		}

	}

	public static void main(String args[])
	{
		Stack s = new Stack();

		s.push(1);
		s.push(2);
		s.pop();
		s.pop();
	}


}									

Download Program
Did You Know ?
IP address is a numerical label that is assigned to devices participating in a computer network. Read More