Challenge: Stack and Queue Classes

Complete the StaQue, a custom class implementation challenge

We'll cover the following

Implementing the StaQue class

Write Java code to implement a data structure consisting of both stack and queue functionalities. Implement the following methods in your StaQue class:

  • push()
  • pop()
  • enqueue()
  • dequeue()

After implementation, test your code through the provided test_your_code() method. Return the output array containing the pop() and dequeue() results.

Note: Don’t worry if you need help. You can see the solution by clicking the “Show Solution” button.

Get hands-on with 1200+ tech skills courses.