10:59 pm - Thursday February 23, 2017

Push an item on top of the stack using E 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

BACK

                  The push( ) method Pushes an item onto the top of this stack.

Example Program


import java.util.Stack;

public class Stackpush

{

	public static void main(String args[])

	{

		Stack n = new Stack();

		n.push("a");

		n.push("b");

		n.push("c");

		System.out.println("Stack contain element are: " + n);

	}

}


Output

   Stack contain element are: [a,b,c]

BACK

Filed in: Java Examples

Comments are closed.