Datasets:
ArXiv:
License:
Download data/train/akash-coded/FSD_Java/Lesson-4/Stack/Examples/StackEmptyExample.java from RepoFusion/Stack-Repo: direct link, hf CLI and curl.
- Browser
- Download file 659 Bytes
-
https://huggingface.co/datasets/RepoFusion/Stack-Repo/resolve/bbc90aef76314892f2d54f85da32b81503fb7eb3/data/train/akash-coded/FSD_Java/Lesson-4/Stack/Examples/StackEmptyExample.java
- Command line
-
hf download hf://datasets/RepoFusion/Stack-Repo@bbc90aef76314892f2d54f85da32b81503fb7eb3/data/train/akash-coded/FSD_Java/Lesson-4/Stack/Examples/StackEmptyExample.java
-
curl -L -o StackEmptyExample.java https://huggingface.co/datasets/RepoFusion/Stack-Repo/resolve/bbc90aef76314892f2d54f85da32b81503fb7eb3/data/train/akash-coded/FSD_Java/Lesson-4/Stack/Examples/StackEmptyExample.java
659 Bytes
| import java.util.Stack; | |
| public class StackEmptyExample { | |
| public static void main(String[] args) { | |
| // creating an instance of Stack class | |
| Stack<Integer> stk = new Stack<>(); | |
| // checking stack is empty or not | |
| boolean result = stk.empty(); | |
| System.out.println("Is the stack empty? " + result); | |
| // pushing elements into stack | |
| stk.push(78); | |
| stk.push(113); | |
| stk.push(90); | |
| stk.push(120); | |
| // prints elements of the stack | |
| System.out.println("Elements in Stack: " + stk); | |
| result = stk.empty(); | |
| System.out.println("Is the stack empty? " + result); | |
| } | |
| } |