java - What happens if you push an item into a stack but the initial capacity has already been met? -


stack initial capacity: 5 object[0] = 'h' object[1] = 'a' object[2] = 'p'  object[3] = 'p'  object[4] = 'y'  

what happens if try these executions:

s.push('i'); s.push('s'); 

also stack implementation using array have peek method?

ps. don't have computer , i'm merely on phone asking this. reading book , came question...

the initial capacity starting size of stack's internal array. once initial capacity met, implementations resize underlying array.


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -