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

c# - Unity IoC Lifetime per HttpRequest for UserStore -

Change the color of an oval at click in Java AWT -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -