-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStroagBox.java
More file actions
53 lines (50 loc) · 901 Bytes
/
StroagBox.java
File metadata and controls
53 lines (50 loc) · 901 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import java.util.Arrays;
import java.util.ArrayList;
public class StroagBox {
ArrayList<Object> box = new ArrayList<>();
private int max=5;
public StroagBox()
{
}
public void IsEmpty()
{
System.out.println(this.box.isEmpty());;
}
public void len()
{
System.out.println(this.box.size());
}
public void push(Object x)
{
this.box.add(x);
}
public void tostring()
{
for (int i = 0; i < this.box.size() ; ++i)
{
System.out.print(this.box.get(i)+" ");
}
}
public boolean IsFull()
{
if (this.box.size() == max )
{
return true;
}
else
{
return false;
}
}
public void pop()
{
System.out.println(this.box.get(this.box.size()-1));
this.box.remove(this.box.size()-1);
}
public void top()
{
System.out.println(this.box.get(this.box.size()-1));
}
}
}
}