diff --git a/Java/Data-Structures/STACKS/INBUILT-STACK/Stacks.java b/Java/Data-Structures/STACKS/INBUILT-STACK/Stacks.java new file mode 100644 index 0000000..66c00ad --- /dev/null +++ b/Java/Data-Structures/STACKS/INBUILT-STACK/Stacks.java @@ -0,0 +1,19 @@ +import java.util.Stack; +public class Stacks +{ + public static void main(String[] args) + { + Stack S = new Stack(); + S.push(1); + S.push(2); + S.push(3); + S.pop(); + S.push(4); + + System.out.println(S); + System.out.println("size: "+S.size()); + System.out.println("empty: "+S.empty()); + System.out.println("peek: "+S.peek()); + System.out.println("search: "+S.search(1)); + } +} \ No newline at end of file diff --git a/Java/README.md b/Java/README.md index 8cecb99..908ac3b 100644 --- a/Java/README.md +++ b/Java/README.md @@ -35,6 +35,7 @@ * LINKED STACK * [Linked Stack](Data-Structures/STACKS/LINKED-STACK/LinkedStack.java) * INBUILT STACKS + * [Stack class](Data-Structures/STACKS/INBUILT-STACK/Stacks.java) * MISC STACKS ### :rocket: DYNAMIC PROGRAMMING diff --git a/datastructures.md b/datastructures.md index efb3e5b..3905756 100644 --- a/datastructures.md +++ b/datastructures.md @@ -129,6 +129,7 @@ Indexer for Data Structures Lover * docs * implementation * [C++](C++/Data-Structures/STACKS/stack.cpp) + * [JAVA](Java/Data-Structures/STACKS/INBUILT-STACK/Stacks.java) #### MISC STACKS