0 votes
1 view
in Java by (4.1k points)
How can I convert a string such as "12.34" to a double in Java?

1 Answer

0 votes
by (46.1k points)

You can try Double.parseDouble() to change a String into a double:

String text = "12.34"; // example String

double value = Double.parseDouble(text);

For your situation it seems like you require:

double total = Double.parseDouble(jlbTotal.getText());

double price = Double.parseDouble(jlbPrice.getText());

Related questions

0 votes
1 answer
0 votes
1 answer
asked Aug 6, 2019 in Java by Anvi (10.2k points)
0 votes
1 answer
0 votes
1 answer
asked Jul 26, 2019 in Java by Ritik (3.5k points)
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...