Sorry, may seem like a dumb question, but I haven't seen anyone else ask it on here. I'm trying to create a stack of doubles, by casting them as I pop them out. The only trouble is that the compiler (eclipse) won't let me cast an object to a double. Any suggestions?

Thanks,
Nate

Again, sorry, nevermind.

Double.parseDouble((String)(stack.lastElement()));

duh...

To cut down on parenthesis you could call toString():

stack.lastElement().toString()
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.