You can use Double.parseDouble() to convert a String to a double:

String text = "12.34"; // example String
double value = Double.parseDouble(text);

For your case it looks like you want:

double total = Double.parseDouble(jlbTotal.getText());
double price = Double.parseDouble(jlbPrice.getText());
Answer from WhiteFang34 on Stack Overflow
🌐
GeeksforGeeks
geeksforgeeks.org › java › convert-string-to-double-in-java
Convert String to Double in Java - GeeksforGeeks
August 17, 2026 - Example: Program to Convert String to Double Using parseDouble() Method. Java · class Geeks { public static void main(String[] args) { String str = "2033.12244"; double value = Double.parseDouble(str); System.out.println(value); } } Output ...
🌐
Baeldung
baeldung.com › home › java › java string › convert string to double in java
Convert String to Double in Java | Baeldung
January 8, 2024 - We can convert a String to a double using the Double.parseDouble method: assertEquals(1.23, Double.parseDouble("1.23"), 0.000001); Similarly, we can convert a String into a boxed Double using the Double.valueOf method: assertEquals(1.23, ...
🌐
BeginnersBook
beginnersbook.com › 2013 › 12 › how-to-convert-string-to-double-in-java
Java Convert String to Double examples
September 11, 2022 - There are three ways to convert String to double. 1. Java – Convert String to Double using Double.parseDouble(String) method 2. Convert String to Double in Java using Double.valueOf(String) 3.
🌐
Blogger
javarevisited.blogspot.com › 2011 › 10 › convert-double-to-string-example.html
How to Convert String to Double in Java Program with Example
This method can also throw NumberFormatException if String is null or not convertible to double. though Whitespace is ignored by Java.
🌐
Codemia
codemia.io › home › knowledge hub › convert string to double in java
Convert String to double in Java | Codemia
January 26, 2025 - It is fast, simple, and correct for normal Java-style numeric text such as "3.14" or "1e6". The real challenge is not the conversion itself. It is deciding what should happen when the input is invalid, locale-specific, or too precise for binary floating-point. ... 1public class ParseDoubleExample { 2 public static void main(String[] args) { 3 String text = "23.456"; 4 double value = Double.parseDouble(text); 5 System.out.println(value); 6 } 7}
🌐
DigitalOcean
digitalocean.com › community › tutorials › java-convert-string-to-double
Java Convert String to double | DigitalOcean
August 3, 2022 - From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.
🌐
Vultr Docs
docs.vultr.com › java › examples › convert string variables to double
Java Program to convert string variables to double | Vultr Docs
December 20, 2024 - Use DecimalFormat to handle these cases and parse strings into doubles according to locale-specific rules. ... import java.text.DecimalFormat; import java.text.ParseException; String euroNumberStr = "1.234,56"; DecimalFormat format = new DecimalFormat("#,##0.00"); try { double number = format.parse(euroNumberStr).doubleValue(); System.out.println(number); } catch (ParseException e) { System.out.println("Number format error: " + e.getMessage()); }
Find elsewhere
🌐
Java Guides
javaguides.net › 2018 › 08 › java-convert-string-to-double-example.html
Convert String To Double in Java
June 15, 2024 - The DecimalFormat class allows you to parse a string into a double using a specific pattern. import java.text.DecimalFormat; import java.text.ParseException; public class StringToDoubleUsingDecimalFormat { public static void main(String[] args) { String strValue = "1234.56"; // Convert string to double using DecimalFormat DecimalFormat decimalFormat = new DecimalFormat("#.##"); try { double doubleValue = decimalFormat.parse(strValue).doubleValue(); System.out.println("String value: " + strValue); System.out.println("Double value: " + doubleValue); } catch (ParseException e) { e.printStackTrace(); } } }
🌐
Mkyong
mkyong.com › home › java › java – convert string to double
Java – Convert String to double | mkyong.com
May 3, 2019 - In Java, we can use Double.parseDouble() to convert a String to double · Example to convert a String 3.142 to an primitive double. String str = "3.142"; double pi = Double.parseDouble(str); System.out.println(pi); Output · 3.142 · Example ...
🌐
Java67
java67.com › 2015 › 06 › how-to-convert-string-to-double-java-example.html
How to convert String to Double in Java and double to String with Example | Java67
Just make sure that empty String literal i.e. "" should be the first argument or else + operator will do addition instead of String concatenation. The second method is mainly for the Double objects, but don't worry even if you have a double value you can leverage autoboxing to first convert it into a Double object and then just call the toString() method on it to get an equivalent String in Java.
🌐
Blogger
javahungry.blogspot.com › 2019 › 01 › convert-String-to-double-in-java.html
5 ways : How to Convert from String to double in Java | Java Hungry
public class StringToDouble { public ... doubleNum); } } Output : Convert String to double 1011.99 · The class java.text.DecimalFormat parse(String str) method can be used to convert String to double....
🌐
Ispectra
ispectra.co › blog › mastering-string-double-conversion-programming
String to Double Conversion in Java & C++ - Best Methods | ISPECTRA
Double.parseDouble() is the fastest and most commonly used method for string-to-double conversion in Java.
🌐
Software Testing Help
softwaretestinghelp.com › home › java › methods to convert java string to double [with examples]
Methods To Convert Java String To Double [With Examples]
April 1, 2025 - Answer: Java provides various methods for turning a string into a double. ... Answer: Yes. Java provides various primitive data types to store numeric values like short, int, double, etc. double is a Java primitive data type for representing a floating-point number.
🌐
Oracle
docs.oracle.com › javase › 8 › docs › api › java › lang › Double.html
Double (Java Platform SE 8 )
July 21, 2026 - Java™ Platform Standard Ed. 8 ... The Double class wraps a value of the primitive type double in an object. An object of type Double contains a single field whose type is double. In addition, this class provides several methods for converting a double to a String and a String to a double, as well as other constants and methods useful when dealing with a double.
🌐
LabEx
labex.io › tutorials › java-java-double-parsedouble-method-117627
double.parsedouble in Java | LabEx
Java parseDouble() method is used to convert string values to their equivalent double values. This is an important method when it comes to data type conversion.
🌐
JavaMadeSoEasy
javamadesoeasy.com › 2016 › 03 › how-to-convert-string-to-double-and.html
JavaMadeSoEasy.com (JMSE): How to convert String to double and double to string in java
In this core java tutorial we will learn how to convert String to double primitive type in java and convert String to double object with program and examples in java.
🌐
WsCube Tech
wscubetech.com › resources › java › programs › string-to-double
Convert String to Double in Java (4 Programs)
September 16, 2026 - Learn 4 simple ways to convert a String to Double in Java. Explore examples using Double.parseDouble(), valueOf(), Scanner methods, and more. Read now!
🌐
Medium
medium.com › @AlexanderObregon › converting-between-strings-and-numbers-in-java-604741d30f4c
Converting Between Strings and Numbers in Java | Medium
June 12, 2025 - Both methods give you the same kind of string. The difference is that valueOf is part of the String class, and the toString method lives on the wrapper classes like Integer and Double. In most cases, it doesn’t matter which one you use.