Can we use both push and pop in both queue and stack???
Minishreddy Vaidhyula you can , they are just names ,changing the function name won't change the functionality !! But if someone expects you to have name of the methods as push and pop then you can't obviously use any name for it.
Don't we already use it ? In queue we push element from the front while in stack we push element from the back. In queue we remove(pop) element from the front while in stack we remove element from the back. There can be different implementation of both but that's how it works.
you can, but Queue in java api has add() and remove() instead
Can we use add in the place of push in both queue and stack ??