Creating Generic array

For creating a stack using Arrays

I wrote the following code :

And typecasted to T type while popping :

I also tried using this client code and it worked.

Hi @vivek21,
what is your question ?

I want to know the way I created generic array in generic stack is acceptable or not?

See it is not totally acceptable but if it is working then it is .You are using object type array in data which must be T instead.So i would suggest that watch video again and understand the concept and apply the concept. You can innovate on questions but concepts must be learned with accurate understanding as your code may work for some case but not for others .

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.