Skip to content

Commit b6d0996

Browse files
committed
add new example
1 parent a0a9e69 commit b6d0996

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

example-code/StackQueue.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
public class StackQueue {
2+
public static void main(String[] args) {
3+
Stack<String> stack = new Stack<>();
4+
Queue<String> queue = new Queue<>();
5+
stack.push("first");
6+
stack.push("second");
7+
queue.enqueue("first");
8+
queue.enqueue("second");
9+
for (String s : stack)
10+
System.out.println("stack contains " + s);
11+
for (String s : queue)
12+
System.out.println("queue contains " + s);
13+
while (!stack.isEmpty())
14+
System.out.println(stack.pop());
15+
while (!queue.isEmpty())
16+
System.out.println(queue.dequeue());
17+
}
18+
}

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
<script type="text/javascript" src="./CodeMirror3/mode/clike/clike.js"></script>
7272
<script type="text/javascript" src="./CodeMirror3/addon/edit/matchbrackets.js"></script>
7373

74-
<script type="text/javascript" src="./jv-frontend.js?4"></script> <!-- used to be opt-frontend.js -->
74+
<script type="text/javascript" src="./jv-frontend.js?5"></script> <!-- used to be opt-frontend.js -->
7575
<link rel="stylesheet" href="./OnlinePythonTutor/v3/css/opt-frontend.css"/>
7676

7777
</head>

0 commit comments

Comments
 (0)