Jump to content

Java multiplying

bomberblyat
Go to solution Solved by Mira Yurizaki,

Those return a string. You have convert it using something like Integer.parseInt or Float.parseFloat depending on what data type you need before you can do multiplication on it. If you need to do the reverse, use Integer.toString or Float.toString (or whatever data type you used). Though you could probably do something like

int foobar = 1234;
string s = foobar.toString();

(Unless this returns something else, in which case you'd have to use Integer.toString(foobar);)

Hi 

 

Is there any way to get text from label and mutiply it? ive tried label.getText and label2.setText but those doesnt work for me

 

thanks in advance

Link to comment
Share on other sites

Link to post
Share on other sites

Those return a string. You have convert it using something like Integer.parseInt or Float.parseFloat depending on what data type you need before you can do multiplication on it. If you need to do the reverse, use Integer.toString or Float.toString (or whatever data type you used). Though you could probably do something like

int foobar = 1234;
string s = foobar.toString();

(Unless this returns something else, in which case you'd have to use Integer.toString(foobar);)

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×