0

My friend is using Eclipse and doesn't have any problem with this lines:

float secOp = (float) computingStack.pop();
float firstOp = (float) computingStack.pop();

I'm using Netbeans and gives an error in both lines, says that the types are not convertible. I tried to use valueOf() and parseFloat, but any was useful. I'm using generic data for my stack.

1
  • Do you have different java development versions? Commented Apr 20, 2014 at 20:57

1 Answer 1

1

I think you can't cast from object to primitive type. Did you try floatValue()?

float secOp  =  ((Float)computingStack.pop()).floatValue();

Regards

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.