i didnt know if to open a new thread .. but i'm having another problem .. probably casting will do it, but i'm not sure.
i'm filling a stack with many variable: Strings and int
when i pop, it returns me a value of type Object. so my Questions is: how can i know if that returned value is a string or an int !?
The question you should be asking is why you are putting strings and ints into a single stack? In most cases you should use an appropriate interface type for the collection that effectively represents what you expect to do with those objects. Obviously you are placing them in a collection for some reason - the interface should reflect that reason. If you have to use a lot of branched instanceof logic to process those items, you probably need to re-examine your abstraction of the operation for consistency and cohesion.