Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
bomberblyat

Java multiplying

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);)

Recommended Posts

Posted · Original PosterOP

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 post
Share on other sites
Posted · Best Answer

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 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


×