-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
33 lines (26 loc) · 713 Bytes
/
Copy pathMain.java
File metadata and controls
33 lines (26 loc) · 713 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package Stack;
public class Main {
public static void main(String[] args) {
StackArray stackArray=new StackArray();
Student stu1=new Student("a","a",1);
Student stu2=new Student("b","b",2);
stackArray.push(stu1);
stackArray.push(stu2);
// Student obj;
// try {
// obj = (Student)stackArray.pop();
// System.out.println(obj);
// } catch (StackEmptyException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
stackArray.printStack();
try {
Student obj=(Student)stackArray.peek();
System.out.println(obj);
} catch (StackEmptyException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}