5:30 pm - Sunday August 19, 2018

Stack Example Program for push(E item)

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 Push() .
*/
import java.io.*;
import java.util.*;
public class Push
{
public static void main(String args[])
{
Stack s=new Stack();
s.push(1);  //Pushes the item onto the top of stack
s.push(2); //Pushes the item onto the top of stack
s.push(3); //Pushes the item onto the top of stack
s.push(4); //Pushes the item onto the top of stack
System.out.println(s);
}
}

OUTPUT:
[1, 2, 3, 4]

BACK

Filed in: Z-A All Java Codes

Comments are closed.