Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

It asks me to define a new stack that extends ArrayList, but isn\'t that basical

ID: 3685879 • Letter: I

Question

It asks me to define a new stack that extends ArrayList, but isn't that basically what GenericStack does? Do I have to make a new class that explicitly extends ArrayList? People say that's a no no in Java but that it can be done. Please don't make the code complicated, this is only a second semester class, and I want to understand it. (Implement GenericStack using inheritance) In Listing implemented using composition. Define a new stack class that extends ArrayList Draw the UMI. diagram for the classes and then implement GenericStack Write a test program that prompts the user to enter five strings and displays them in reverse order. er

Explanation / Answer

yes you need to make a new class stack that use keyword EXTENDS to inherit arralist class.

for eg something like this

yes the best practice for this would be using composition rather inheritance but this example demands you to use extend keyword.The idea is just to test your knowledge of using inheritance in general.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote