자바 클래스 Stack

(Java Stack에서 넘어옴)

1 개요[ | ]

Java Class Stack
자바 Class Stack
java.util.Stack
Java
CPU
1.7s
MEM
82M
1.3s
Copy
import java.util.Stack;

public class MyClass {
    public static void main(String args[]) {
        Stack<Integer> s = new Stack();
        s.push(1);
        s.push(5);
        s.push(3);
        int num = s.pop();
        System.out.println(num); // 3
        System.out.println(s); // [1, 5]
    }
}
src/App.java:3: error: class MyClass is public, should be declared in a file named MyClass.java
public class MyClass {
       ^
Note: src/App.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Command exited with non-zero status 1
Error: Could not find or load main class App
Caused by: java.lang.ClassNotFoundException: App

2 같이 보기[ | ]

3 참고[ | ]