Skip to content

Commit 88c7821

Browse files
committed
Nia P_Lesson_12feat: implement push method in Stack class to add new elements
1 parent 49d841f commit 88c7821

File tree

1 file changed

+3
-1
lines changed
  • lesson_12/structs_java/structs_app/src/main/java/com/codedifferently/lesson12

1 file changed

+3
-1
lines changed

lesson_12/structs_java/structs_app/src/main/java/com/codedifferently/lesson12/Stack.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ public Stack() {
99
}
1010

1111
public void push(int value) {
12-
// Your code here
12+
ListNode newNode = new ListNode(value);
13+
newNode.next = top;
14+
top = newNode;
1315
}
1416

1517
public int pop() {

0 commit comments

Comments
 (0)