- Suppose We Want To Create A Stack Class That Can Store Objects Of Any Java Class What Would Be The Best Technique To Us 1 (10 KiB) Viewed 32 times
Suppose we want to create a stack class that can store objects of any Java class. What would be the best technique to us
-
- Site Admin
- Posts: 899603
- 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