Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.Stack;

public class Main {
    public static void main(String args[]) {

        Stack st = new Stack();

        st.push("Java");
        st.push("Source");
        st.push("from java2s.com");

        // checking elements
        System.out.println("Elements in the stack: " + st);
    }
}