java - Trying to cast an int to a character in a que -
i have queue of integers , characters , want cast them chars.
queue<object> rpnque = new linkedlist<object>(); rpnque.add(3); rpnque.add('+'); char ch1= (char) rpnque.poll(); not working, trying cast object can math operators on them
write queue contains character.
queue<character> rpnqueue = new linkedlist<>(); then, write switch or equivalent if-else statement determine if character you've polled operator.
you have conversions , forth int (simply put, if isn't operator, subtract '0' (the char 0)).
Comments
Post a Comment