intellij idea - incompatible types: java.lang.Object cannot be converted -


i new java.i writing program pre-order tree traversal

you need use stack<tree> rather stack in fifth line of preoderiter. tells compiler stack stores trees (rather default object) when stack.pop() (see line underlined in red) knows result tree , not object.


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -