[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/tejaspundpal/Java-programs/main/LearnStackCollection.java [Back]  [Original]

import java.util.*;
public class LearnStackCollection {
    public static void main(String args[])
    {
        Stack students = new Stack();
        students.push("Tejas");
        students.push("Sharvari");
        students.push("Jayashri");

        System.out.println(students);

        students.pop();
        System.out.println(students);

        System.out.println(students.isEmpty());
        System.out.println(students.peek());

        System.out.println(students.empty());

        Iterator it = students.iterator();
        while(it.hasNext()){
            System.out.println("stack elements : "+it.next());
        }
    }
}

Web Proxy Viewer  |  New URL  |  Original Page