+ 5
Why do you tag Python when it is Java? Which error do you get? Link your code, so people can test it.
31st Jan 2024, 4:19 PM
Lisa
Lisa - avatar
+ 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); } } }
1st Feb 2024, 8:40 AM
zemiak