✔️ Stack
- LIFO - Last in First out
- 순차적으로 데이터 추가/삭제
import java.util.Stack;
public class practiceStack {
public static void main(String[] args) {
Stack<Integer> stack = new Stack<>();
stack.push(1);
stack.push(2);
stack.push(3);
stack.push(4);
stack.push(5);
System.out.println(stack);
stack.pop();
System.out.println(stack);
stack.pop();
System.out.println(stack);
stack.pop();
System.out.println(stack);
System.out.println(stack.isEmpty());
System.out.println(stack.search(2));
System.out.println(stack.peek());
}
}