Suppose we want to create a stack class that can store objects of any Java class. What would be the best technique to us
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Suppose we want to create a stack class that can store objects of any Java class. What would be the best technique to us
Suppose we want to create a stack class that can store objects of any Java class. What would be the best technique to use? Make Stack a generic class: public class Stack<E> Use overloaded methods Use a generic method Create a static method Create different versions of the Stack class for each object type
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!