/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Neha
*/
public class StackMaking {
static int top;
int[] stack_array = new int[100];
public static void main(String[] args)
{
top = -1;
StackMaking st = new StackMaking();
st.push(4);
st.push(224);
st.push(445);
st.push(41);
st.push(764);
st.push(43);
while(top>=0)
{
int val = st.pop();
System.out.println(val);
}
}
public void push(int i)
{
stack_array[++top] = i;
//System.out.println(stack_array[0]);
}
public int pop()
{
// System.out.println(stack_array[0]);
int poo = stack_array[top--];
return poo;
//System.out.println(stack_array[0]);
}
}
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Neha
*/
public class StackMaking {
static int top;
int[] stack_array = new int[100];
public static void main(String[] args)
{
top = -1;
StackMaking st = new StackMaking();
st.push(4);
st.push(224);
st.push(445);
st.push(41);
st.push(764);
st.push(43);
while(top>=0)
{
int val = st.pop();
System.out.println(val);
}
}
public void push(int i)
{
stack_array[++top] = i;
//System.out.println(stack_array[0]);
}
public int pop()
{
// System.out.println(stack_array[0]);
int poo = stack_array[top--];
return poo;
//System.out.println(stack_array[0]);
}
}
No comments:
Post a Comment