@ Override public void dup ( ) { if ( top < 1 ) { throw new EmptyStackException ( ) ; } if ( top >= stack . length ) { stack = Arrays . copyOf ( stack , ( int ) ( stack . length * growFactor ) ) ; } top ++ ; stack [ top - 1 ] = stack [ top - 2 ] ; }
Top element is pushed .