3:44 pm - Wednesday December 11, 2763

Stack Example Program for pop()

CANDID INDUSTRIAL TRAINING -- CHENNAI
Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044
/**
*@author :CandidJava.com
*@descriptions : This program explain the function and use of pop () .
*/

import java.io.*;
import java.util.*;
public class Pop
{
public static void main(String args[])
{
Stack s=new Stack();
s.push(1);
s.push(2);
s.push(3);
s.push(4);
System.out.println(s);
s.pop(); // Removes the item at the top of the stack
System.out.println(s);
}
}

OUTPUT:
[1, 2, 3, 4]
[1, 2, 3]

BACK

Filed in: Z-A All Java Codes

Comments are closed.