+ 5
Why do you tag Python when it is Java?
Which error do you get?
Link your code, so people can test it.
+ 1
- keep System.in opened,
if you close it, (by sc.close() ) it is imposible read it again !
- also if you change the int variable 'top' inside methods push(), pop(),
it does not affect the 'top' outside the methods (in main() )
rest of code:
System.out.println("Unknown command " +choice);
}
// test
System.out.println( Arrays.toString(stack));
System.out.println( "top="+top);
}
}
}